rtfm-filemanager 3.10 → 3.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rtfm +72 -57
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '080c0934da9294dbad21bd902a119ae0dd533348f19eaa4841ac90f039741fb0'
4
- data.tar.gz: 3839a9ad45595ce3cdec6fd0c9e9e29bc97a268c7876b6e8df9d93a33a9f0ae9
3
+ metadata.gz: dbfb6d5c3e1963f33faa992f302ea07e11e8ead272799293958a4060b2c293a5
4
+ data.tar.gz: 13c4c9097507dd2bd73d98a75cf8e85fc72eaad7494aec8fe8ed9b9bf0069a03
5
5
  SHA512:
6
- metadata.gz: 112a9732a52ca5d42405daf9e6405d6c86d54d434bfdbebb4da7bba5a1ef7dbfedad6a9293a3c65531320c2b317ae8300c7b0d49ebe15a83b51f21f991d07f19
7
- data.tar.gz: e73ff6c29ee8e951bd255c21c2125b18431472f23d2e9a3876f5d738f8efd11748b4983ee34fd7ef5576e24c9d2c34ffe8fbd106ec4fd31b40668536d9818625
6
+ metadata.gz: cbd027f69aa06ab38750d352872d26670eb559cbf5c09c0221e00a40b492faa5a19db10b81858c088dbcd2efa39b1c7047c7670456d60492f4c4ee624968f7f3
7
+ data.tar.gz: 2702fad4c85c61f986d96d932505217ae05cc8a407649d9acb0494793ccc85e0ef896ad06dabd75cbda2b364e51ea87043ed6ded48abceb271de053a9faa6614
data/bin/rtfm CHANGED
@@ -14,7 +14,7 @@
14
14
  # for any damages resulting from its use. Further, I am under no
15
15
  # obligation to maintain or extend this software. It is provided
16
16
  # on an 'as is' basis without any expressed or implied warranty.
17
- @version = "3.10"
17
+ @version = "3.12"
18
18
 
19
19
  # PRELIMINARIES
20
20
  @help = <<HELPTEXT
@@ -211,42 +211,43 @@ begin # BASIC SETUP
211
211
 
212
212
  # INITIALIZE VARIABLES
213
213
  ## These can be set by user in .rtfm.conf
214
- @lsbase = "--group-directories-first" # Basic ls setup
215
- @lslong = false # Set short form ls (toggled by pressing "l")
216
- @lsall = "" # Set "ls -a" to false (toggled by pressing "a" - sets it to "-a")
217
- @lsorder = "" # Change the order/sorting by pressing 'o' (circular toggle)
218
- @lsinvert = "" # Set to "-r" to reverse/invert sorting order
219
- @lsuser = "" # Set this variable in .rtfm.conf to any 'ls' switch you want to customize directory listings
220
- @width = 4 # Set width of the left pane to the default ⅓ of the terminal width
221
- @history = [] # Initialize the command line history array
222
- @border = false
223
- @preview = true
224
- @runmailcap = false # Set to 'true' in .rtfm.conf if you want to use run-mailcap instead of xdg-open
225
- @batuse = true # Use batcat for syntax highlighting
214
+ @lsbase = "--group-directories-first" # Basic ls setup
215
+ @lslong = false # Set short form ls (toggled by pressing "l")
216
+ @lsall = "" # Set "ls -a" to false (toggled by pressing "a" - sets it to "-a")
217
+ @lsorder = "" # Change the order/sorting by pressing 'o' (circular toggle)
218
+ @lsinvert = "" # Set to "-r" to reverse/invert sorting order
219
+ @lsuser = "" # Set this variable in .rtfm.conf to any 'ls' switch you want to customize directory listings
220
+ @width = 4 # Set width of the left pane to the default ⅓ of the terminal width
221
+ @history = [] # Initialize the command line history array
222
+ @rubyhistory = [] # Initialize the command line history array for ruby commands
223
+ @border = false
224
+ @preview = true
225
+ @runmailcap = false # Set to 'true' in .rtfm.conf if you want to use run-mailcap instead of xdg-open
226
+ @batuse = true # Use batcat for syntax highlighting
226
227
  ## These are automatically written on exit
227
- @marks = {} # Initialize (book)marks hash
228
- @hash = {} # Initialize the sha directory hashing
229
- @tagged = [] # Initialize the tagged array - for collecting all tagged items
228
+ @marks = {} # Initialize (book)marks hash
229
+ @hash = {} # Initialize the sha directory hashing
230
+ @tagged = [] # Initialize the tagged array - for collecting all tagged items
230
231
  ## These should not be set by user in .rtfm.conf
231
- @directory = {} # Initialize the directory hash for remembering directories visited
232
- @searched = "" # Initialize the active searched for items
233
- @lsfiles = "" # File types to show (initially set to all file types) - not saved on exit
234
- @lsmatch = "" # Files to match (initially set to matching all files) - not saved on exit
235
- @index = 0 # Set chosen item to first on startup
236
- @cont = ""
237
- @tagsize = 0
238
- @navi = ""
239
- @marks["'"] = Dir.pwd
232
+ @directory = {} # Initialize the directory hash for remembering directories visited
233
+ @searched = "" # Initialize the active searched for items
234
+ @lsfiles = "" # File types to show (initially set to all file types) - not saved on exit
235
+ @lsmatch = "" # Files to match (initially set to matching all files) - not saved on exit
236
+ @index = 0 # Set chosen item to first on startup
237
+ @cont = ""
238
+ @tagsize = 0
239
+ @navi = ""
240
+ @marks["'"] = Dir.pwd
240
241
  ## File type recognizers
241
- @imagefile = /\.jpg$|\.JPG$|\.jpeg$|\.png$|\.bmp$|\.gif$|\.tif$|\.tiff$/
242
- @pptfile = /\.ppt$/
243
- @xlsfile = /\.xls$/
244
- @docfile = /\.doc$/
245
- @docxfile = /\.docx$/
246
- @xlsxfile = /\.xlsx$/
247
- @pptxfile = /\.pptx$/
248
- @oolofile = /\.odt$|\.odc$|\.odp$|\.odg$/
249
- @pdffile = /\.pdf$|\.ps$/
242
+ @imagefile = /\.jpg$|\.JPG$|\.jpeg$|\.png$|\.bmp$|\.gif$|\.tif$|\.tiff$/
243
+ @pptfile = /\.ppt$/
244
+ @xlsfile = /\.xls$/
245
+ @docfile = /\.doc$/
246
+ @docxfile = /\.docx$/
247
+ @xlsxfile = /\.xlsx$/
248
+ @pptxfile = /\.pptx$/
249
+ @oolofile = /\.odt$|\.odc$|\.odp$|\.odg$/
250
+ @pdffile = /\.pdf$|\.ps$/
250
251
  ## Get variables from config file (written back to .rtf.conf upon exit via 'q')
251
252
  if File.exist?(Dir.home+'/.rtfm.conf')
252
253
  load(Dir.home+'/.rtfm.conf')
@@ -876,7 +877,7 @@ def main_getkey # GET KEY FROM USER
876
877
  @break = true
877
878
  when '@' # Enter "Ruby debug"
878
879
  @w_b.nohistory = false
879
- cmd = w_b_getstr("◆ ", "")
880
+ cmd = w_b_getstr("◆ ", "", true)
880
881
  @w_b.clr
881
882
  @w_b.refresh
882
883
  @w_b.update = true
@@ -912,6 +913,10 @@ def conf_write
912
913
  conf += "@hash = #{@hash}\n"
913
914
  conf.sub!(/^@tagged.*\[.*\]\n/, "")
914
915
  conf += "@tagged = #{@tagged}\n"
916
+ conf.sub!(/^@history.*\[.*\]\n/, "")
917
+ conf += "@history = #{@history}\n"
918
+ conf.sub!(/^@rubyhistory.*\[.*\]\n/, "")
919
+ conf += "@rubyhistory = #{@rubyhistory}\n"
915
920
  if @write_conf_all
916
921
  conf.sub!(/^@lslong.*\n/, "")
917
922
  conf += "@lslong = #{@lslong}\n"
@@ -1426,17 +1431,23 @@ def w_b_info(info) # SHOW INFO IN @W_B
1426
1431
  @w_b.write
1427
1432
  @w_b.update = false
1428
1433
  end
1429
- def w_b_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
1434
+ def w_b_getstr(pretext, text, ruby=false) # A SIMPLE READLINE-LIKE ROUTINE
1430
1435
  Curses.curs_set(1)
1431
1436
  Curses.echo
1432
1437
  stk = 0
1433
- @history.insert(stk, text)
1434
- pos = @history[stk].length
1435
1438
  chr = ""
1439
+ if ruby
1440
+ @rubyhistory.insert(stk, text)
1441
+ @history_copy = @rubyhistory.map(&:clone)
1442
+ else
1443
+ @history.insert(stk, text)
1444
+ @history_copy = @history.map(&:clone)
1445
+ end
1446
+ pos = @history_copy[stk].length
1436
1447
  while chr != "ENTER"
1437
1448
  @w_b.setpos(0,0)
1438
1449
  init_pair(250, 250, 238)
1439
- text = pretext + @history[stk]
1450
+ text = pretext + @history_copy[stk]
1440
1451
  text += " " * (@w_b.maxx - text.length) if text.length < @w_b.maxx
1441
1452
  @w_b.attron(color_pair(250)) { @w_b << text }
1442
1453
  @w_b.setpos(0,pretext.length + pos)
@@ -1451,50 +1462,50 @@ def w_b_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
1451
1462
  case chr
1452
1463
  when 'UP'
1453
1464
  unless @w_b.nohistory
1454
- unless stk == @history.length - 1
1465
+ unless stk == @history_copy.length - 1
1455
1466
  stk += 1
1456
- pos = @history[stk].length
1467
+ pos = @history_copy[stk].length
1457
1468
  end
1458
1469
  end
1459
1470
  when 'DOWN'
1460
1471
  unless @w_b.nohistory
1461
1472
  unless stk == 0
1462
1473
  stk -= 1
1463
- pos = @history[stk].length
1474
+ pos = @history_copy[stk].length
1464
1475
  end
1465
1476
  end
1466
1477
  when 'RIGHT'
1467
- pos += 1 unless pos > @history[stk].length
1478
+ pos += 1 unless pos > @history_copy[stk].length
1468
1479
  when 'LEFT'
1469
1480
  pos -= 1 unless pos == 0
1470
1481
  when 'HOME'
1471
1482
  pos = 0
1472
1483
  when 'END'
1473
- pos = @history[stk].length
1484
+ pos = @history_copy[stk].length
1474
1485
  when 'DEL'
1475
- @history[stk][pos] = ""
1486
+ @history_copy[stk][pos] = ""
1476
1487
  when 'BACK'
1477
1488
  unless pos == 0
1478
1489
  pos -= 1
1479
- @history[stk][pos] = ""
1490
+ @history_copy[stk][pos] = ""
1480
1491
  end
1481
1492
  when 'WBACK'
1482
1493
  unless pos == 0
1483
- until @history[stk][pos - 1] == " " or pos == 0
1494
+ until @history_copy[stk][pos - 1] == " " or pos == 0
1484
1495
  pos -= 1
1485
- @history[stk][pos] = ""
1496
+ @history_copy[stk][pos] = ""
1486
1497
  end
1487
- if @history[stk][pos - 1] == " "
1498
+ if @history_copy[stk][pos - 1] == " "
1488
1499
  pos -= 1
1489
- @history[stk][pos] = ""
1500
+ @history_copy[stk][pos] = ""
1490
1501
  end
1491
1502
  end
1492
1503
  when 'LDEL'
1493
- @history[stk] = ""
1504
+ @history_copy[stk] = ""
1494
1505
  pos = 0
1495
1506
  when 'TAB' # Tab completion of dirs and files
1496
1507
  p1 = pos - 1
1497
- c = @history[stk][0..(p1)].sub(/^.* /, '')
1508
+ c = @history_copy[stk][0..(p1)].sub(/^.* /, '')
1498
1509
  p0 = p1 - c.length
1499
1510
  compl = File.expand_path(c)
1500
1511
  compl += "/" if Dir.exist?(compl)
@@ -1529,24 +1540,28 @@ def w_b_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
1529
1540
  Curses.echo
1530
1541
  end
1531
1542
  end
1532
- @history[stk].sub!(c,compl)
1543
+ @history_copy[stk].sub!(c,compl)
1533
1544
  pos = pos - c.length + compl.length
1534
1545
  when /^.$/
1535
- @history[stk].insert(pos,chr)
1546
+ @history_copy[stk].insert(pos,chr)
1536
1547
  pos += 1
1537
1548
  end
1538
1549
  while STDIN.ready?
1539
1550
  chr = STDIN.getc
1540
- @history[stk].insert(pos,chr)
1551
+ @history_copy[stk].insert(pos,chr)
1541
1552
  pos += 1
1542
1553
  end
1543
1554
  end
1544
- curstr = @history[stk]
1545
- @history.shift if @w_b.nohistory
1555
+ curstr = @history_copy[stk]
1556
+ @history_copy.shift if @w_b.nohistory
1557
+ ruby ? @rubyhistory.insert(0, @history_copy[stk]) : @history.insert(0, @history_copy[stk])
1546
1558
  unless @w_b.nohistory
1547
1559
  @history.uniq!
1548
1560
  @history.compact!
1549
1561
  @history.delete("")
1562
+ @rubyhistory.uniq!
1563
+ @rubyhistory.compact!
1564
+ @rubyhistory.delete("")
1550
1565
  end
1551
1566
  Curses.curs_set(0)
1552
1567
  Curses.noecho
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtfm-filemanager
3
3
  version: !ruby/object:Gem::Version
4
- version: '3.10'
4
+ version: '3.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-28 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -47,7 +47,8 @@ dependencies:
47
47
  description: 'A full featured terminal browser with syntax highlighted files, images
48
48
  shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around
49
49
  easily, delete, rename, copy, symlink and move files. RTFM has a a wide range of
50
- other features. New in 3.10: Critical bugfix on syntax highlighting.'
50
+ other features. New in 3.12: Ruby commands gets its own history. Histories are now
51
+ saved/restored.'
51
52
  email: g@isene.com
52
53
  executables:
53
54
  - rtfm