cetus 0.1.26 → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cetus +43 -14
  3. data/cetus.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e330d082b6cacb3bc2bb8294f240e1dbe52c020f67036e7749c23975ad74315e
4
- data.tar.gz: 233d66a84c34f2909ced5d9d0c2a7ee9b6f251f812190cd51fa74df0a7d685ad
3
+ metadata.gz: c689f29c889a219679641ca86f77c1d5ac5fc11b34fa4bda3cbb1b24c6b51465
4
+ data.tar.gz: 31f029702a9ab594e17dee2eeeedd6e1937feb222757d31e1657676c8767f78c
5
5
  SHA512:
6
- metadata.gz: 167c052b0de647248274ae297dd0dc7ec02a1ed597abd93622a53ca65b06de13723f466d0476ef52aba505ebe2b5d44eb59ecd8c095d47b7bea792d8041ea5e9
7
- data.tar.gz: f83e861550b178f4eedc21138645df39fea00f55fd450353f12c6e797137f1902646859bb273238f1219611bfb092292646c3befd7b421757bdc3f4a193c9f6a
6
+ metadata.gz: b8ef2819bc7194bc090c7979cdeb979bfacf3abf9d74e533333a1497d3bb35c4c7c6ba39a8dadc4b14c4eef2b3a75b186a800799c4c06435fa1e5264a7a95d6b
7
+ data.tar.gz: 752365289cd8e1bb8d7418e44406a9e303971f3ed024bf25f4b36431bee15a2b57afdf6150267b9d0adfeb116fbe2254c6f04a2793619fc71f42a6049b996120
data/bin/cetus CHANGED
@@ -6,7 +6,7 @@
6
6
  # Author: rkumar http://github.com/rkumar/cetus/
7
7
  # Date: 2013-02-17 - 17:48
8
8
  # License: GPL
9
- # Last update: 2019-03-20 11:43
9
+ # Last update: 2019-03-21 09:29
10
10
  # --------------------------------------------------------------------------- #
11
11
  # cetus.rb Copyright (C) 2012-2019 rahul kumar
12
12
  # == CHANGELOG
@@ -35,7 +35,7 @@ require 'fileutils'
35
35
 
36
36
  # 2019-02-20 - added so alt-screen is used
37
37
  system 'tput smcup'
38
- VERSION = '0.1.26.0'.freeze
38
+ VERSION = '0.1.27.0'.freeze
39
39
  CONFIG_FILE = '~/.config/cetus/conf.yml'.freeze
40
40
 
41
41
  $bindings = {}
@@ -284,7 +284,7 @@ $grows = $glines - 3 # can be a func
284
284
  # $pagesize = 60
285
285
  $gviscols = 3
286
286
  $pagesize = $grows * $gviscols # can be a func
287
- $stact = 0
287
+ $stact = 0 # used when panning a folder to next column
288
288
  # $editor_mode = true
289
289
  $editor_mode = false # changed 2018-03-12 - so we start in pager mode
290
290
  $enhanced_mode = true
@@ -354,7 +354,6 @@ def run
354
354
  $patt = nil
355
355
  $sta = 0
356
356
  loop do
357
- # i = 0
358
357
  $view = if $patt
359
358
  if $ignorecase
360
359
  $files.grep(/#{$patt}/i)
@@ -368,11 +367,21 @@ def run
368
367
  $sta = 0 if $sta >= fl || $sta < 0
369
368
  # 2019-03-18 - added to ensure cursor not going OOB when next_page
370
369
  $cursor = 0 if $cursor >= fl || $cursor < 0
370
+ # NOTE if we make cursor zero, then it can be < sta so in the next line
371
+ # it will be made equal to sta which we may not want
371
372
  # $sta = $cursor if $sta > $cursor
372
373
  $cursor = $sta if $sta > $cursor
373
374
 
374
375
  $viewport = $view[$sta, $pagesize]
375
376
  fin = $sta + $viewport.size
377
+ # added 2019-03-20 - actually stact should be reduced not brought to zero
378
+ # 2019-03-21 - NOTE this may be redundant since I set to zero in next_page
379
+ # due to various edge cases.
380
+ # $stact = 0 if $stact >= $viewport.size
381
+ if $stact >= $viewport.size
382
+ $stact -= $grows while $stact >= $viewport.size
383
+ $stact += $grows if $stact < 0
384
+ end
376
385
  $title ||= Dir.pwd.sub(home, '~')
377
386
  clear_screen
378
387
 
@@ -413,15 +422,19 @@ def run
413
422
  if cf
414
423
  cfl = cf.size
415
424
  # print right alighed
416
- system "tput cup #{$glines} #{$gcols - cfl - 10}"
425
+ system "tput cup #{$glines} #{$gcols - cfl - 25}"
417
426
  # print "#{REVERSE}#{cf}#{CLEAR}"
418
- print "#{cf}"
427
+ if $debug_flag
428
+ print "#{$sta},#{$cursor},#{$stact},#{$viewport.size},#{$grows} | #{cf}"
429
+ else
430
+ print "#{cf}"
431
+ end
419
432
  end
420
433
  # print "\r#{v_mm}#{$patt} #{GREEN}#{$message}#{CLEAR} >"
421
434
  # move to beginning of line, reset text mode after printing
422
435
  print "\r#{v_mm}#{$patt}#{$message}\e[m"
423
436
  ch = get_char
424
- $highlighted_a_column = false
437
+ # $highlighted_a_column = false
425
438
  # puts
426
439
  # break if ch == "q"
427
440
  # elsif ch =~ /^[1-9a-zA-Z]$/
@@ -985,16 +998,23 @@ def enter_regex
985
998
  end
986
999
 
987
1000
  # page/scroll down.
988
- # TODO: 2019-03-18 - cursor needs to be updated
989
1001
  def next_page
990
1002
  $sta += $pagesize
991
1003
  $cursor += $pagesize
992
1004
  $sta = $cursor if $sta > $cursor
993
1005
  # FIXME this is sometimes correct, but in short cases, cursor no longer refers
994
1006
  # to a file. also after cycling, it no longer has a file.
1007
+ # FIXME: 2019-03-20 - if cursor is panned to 3rd column and then we page,
1008
+ # then after a while no hints show up since stact is high.
1009
+ $stact = 0
1010
+ # next just does not work on the last page when it should
1011
+ # perhaps viewport has not yet been adjusted, that's why
1012
+ # $stact = 0 if $stact >= $viewport.size
1013
+ # setting to zero is not the best solution since hints are reset but this is better
1014
+ # than trying to maintain the same stact since the columns reduce in the end.
1015
+ # I tried checking that stact < viewport.size but nothing happened
995
1016
  end
996
1017
 
997
- # TODO: 2019-03-18 - cursor needs to be updated
998
1018
  def prev_page
999
1019
  $sta -= $pagesize
1000
1020
  $cursor -= $pagesize
@@ -1075,6 +1095,7 @@ def page_with_tempfile
1075
1095
  end
1076
1096
 
1077
1097
  def debug_vars
1098
+ $debug_flag = true
1078
1099
  page_with_tempfile do |file|
1079
1100
  file.puts 'DEBUG VARIABLES ARE:'
1080
1101
  file.puts
@@ -1084,6 +1105,7 @@ def debug_vars
1084
1105
  file.puts "viewport.size #{$viewport.size}"
1085
1106
  file.puts "pagesize #{$pagesize}"
1086
1107
  file.puts "view.size #{$view.size}"
1108
+ file.puts "grows #{$grows}"
1087
1109
  file.puts "file #{current_file}"
1088
1110
  end
1089
1111
  end
@@ -1213,6 +1235,8 @@ def toggle_menu
1213
1235
  message "Ignore Case is now #{$ignorecase}"
1214
1236
  refresh
1215
1237
  when :toggle_columns
1238
+ # FIXME: 2019-03-20 - if 3 then 1
1239
+ # adjust stact and sta, if moving from panned position
1216
1240
  $gviscols = 3 if $gviscols == 1
1217
1241
  # $long_listing = false if $gviscols > 1
1218
1242
  x = $grows * $gviscols
@@ -1240,6 +1264,11 @@ def toggle_menu
1240
1264
  x = $grows * $gviscols
1241
1265
  $pagesize = $pagesize == x ? $grows : x
1242
1266
  end
1267
+ if $stact > 0
1268
+ # FIXME what if we had paged down as well and sta was > 0
1269
+ $sta = $stact
1270
+ $stact = 0 # in case user was panned 2019-03-20 -
1271
+ end
1243
1272
  message "Long listing is #{$long_listing}"
1244
1273
  refresh
1245
1274
  end
@@ -1743,11 +1772,11 @@ def column_next(direction = 0)
1743
1772
  $cursor += $grows
1744
1773
  # 2019-03-18 - zero loses offset. we need to maintain it
1745
1774
  # $cursor = 0 if $cursor >= $viewport.size
1746
- if $cursor >= $viewport.size
1747
- while $cursor > 0
1748
- $cursor -= $grows
1749
- end
1750
- $cursor += $grows if $cursor < 0
1775
+ if $cursor - $sta >= $viewport.size
1776
+ $cursor -= $grows while $cursor > $sta
1777
+ $stact -= $grows while $stact > 0
1778
+ $cursor += $grows if $cursor < $sta
1779
+ $stact += $grows if $stact < 0
1751
1780
  end
1752
1781
  else
1753
1782
  $stact -= $grows
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'cetus'
8
- spec.version = '0.1.26'
8
+ spec.version = '0.1.27'
9
9
  spec.authors = ['Rahul Kumar']
10
10
  spec.email = ['oneness.univ@gmail.com']
11
11
  spec.description = %q{lightning fast file navigator}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cetus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.26
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rahul Kumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-20 00:00:00.000000000 Z
11
+ date: 2019-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler