diakonos 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 930f2f93739226857f62e39e39a0236e40b4aac2fd89208b47a5df3ba5db9372
4
- data.tar.gz: fc967fd5b22694895f13ea1551fe366ce5fe656a4ac2ded8304b04594464580b
3
+ metadata.gz: 9124da7083b3827e1bed0f21f3cc4128b0ec8fb230dc0d4f0110c6eb2d065c25
4
+ data.tar.gz: 21015d0f4741458b7a29fbb31aa4b540cd72a76016ad6182915bfb02c3c6b513
5
5
  SHA512:
6
- metadata.gz: 8d8c2e2c406726e490d44149d00b5be4ac650feebee4d30433eace1096d23f791edd375c8ea65585ed4e9e9041601223bd53b41e081be3d55a234023152b29a3
7
- data.tar.gz: e23410cd82d3ff4e7c720f5612c9e746c30302ad0380d8637fe33b7e245375721353ed9177861cfe8330f84d0009015dda3140c07886d5bc0c246550765f1022
6
+ metadata.gz: ab053642dfc44bd02868ebe558e3981710b441ba0702177e53cd8f3b9bdab80692ee08652ab2c8e0b4e88a720a60f02f4c8fa38f8ef8f842c23ad9490b1dc717
7
+ data.tar.gz: cb423f02fd99dcf544eaff9f0205efb52a05ff4f085a5336d855d2d97e4c6225b238c4c456497e11f64126edae94871e1088270e2eb478e7dfd04d6472beafa5
data/CHANGELOG CHANGED
@@ -1,6 +1,12 @@
1
1
  Diakonos Changelog
2
2
  ------------------
3
3
 
4
+ 0.9.9
5
+
6
+ - List main culprits (directories) when fuzzy file finder encounters too many files
7
+ - Add support for extension configuration settings
8
+ - Make compatible with Ruby 3.2 (re: File.exists?)
9
+
4
10
  0.9.8
5
11
 
6
12
  - Handle symlink cycles when fuzzy file finding (file open)
data/diakonos.conf CHANGED
@@ -918,8 +918,8 @@ lang.javascript.indent.size 2
918
918
  lang.javascript.indent.auto true
919
919
  lang.javascript.indent.roundup false
920
920
  #lang.javascript.indent.using_tabs true
921
- lang.javascript.indent.indenters (\{)
922
- lang.javascript.indent.unindenters (\})
921
+ lang.javascript.indent.indenters ([{(])
922
+ lang.javascript.indent.unindenters ([})])
923
923
  lang.javascript.indent.preventers (\".+?[^\\]\")|('.+?[^\\]')|(\/\/.*)
924
924
  lang.javascript.indent.ignore ^(.+:|\s*?)$
925
925
  lang.javascript.indent.closers true
@@ -30,7 +30,7 @@ module Diakonos
30
30
  f.puts %{
31
31
  # About Diakonos
32
32
 
33
- Licence: MIT Licence
33
+ Licence: GNU GPL v3
34
34
  Copyright: Copyright (c) 2004-#{ Time.now.year } Pistos
35
35
 
36
36
  ## Version
@@ -43,6 +43,7 @@ Ruby Version: #{ ::RUBY_VERSION }
43
43
  ## Paths
44
44
 
45
45
  Home dir: #{ @diakonos_home }
46
+ Session dir: #{ @session.dir }
46
47
 
47
48
  ### Installation
48
49
 
@@ -32,6 +32,9 @@ module Diakonos
32
32
  end
33
33
  end
34
34
 
35
+ if open_match_text
36
+ # $diakonos.debug_log "OPEN\t" + [ open_index, open_token_class, open_match_text ].inspect
37
+ end
35
38
  [ open_index, open_token_class, open_match_text ]
36
39
  end
37
40
 
@@ -55,6 +58,9 @@ module Diakonos
55
58
  end
56
59
  end
57
60
 
61
+ if close_match_text
62
+ # $diakonos.debug_log "CLOSE\t" + [close_index, close_match_text].inspect
63
+ end
58
64
  [close_index, close_match_text]
59
65
  end
60
66
 
@@ -9,7 +9,7 @@ module Diakonos
9
9
  name = @name
10
10
  end
11
11
 
12
- if @read_only && FileTest.exists?( @name ) && FileTest.exists?( name ) && ( File.stat( @name ).ino == File.stat( name ).ino )
12
+ if @read_only && FileTest.exist?( @name ) && FileTest.exist?( name ) && ( File.stat( @name ).ino == File.stat( name ).ino )
13
13
  $diakonos.set_iline "#{name} cannot be saved since it is read-only."
14
14
  else
15
15
  @read_only = false
@@ -18,7 +18,7 @@ module Diakonos
18
18
  else
19
19
  proceed = true
20
20
 
21
- if prompt_overwrite && FileTest.exists?( name )
21
+ if prompt_overwrite && FileTest.exist?( name )
22
22
  proceed = false
23
23
  choice = $diakonos.get_choice(
24
24
  "Overwrite existing '#{name}'?",
@@ -55,7 +55,7 @@ module Diakonos
55
55
  @lines[ 0 ] = ""
56
56
  else
57
57
  @name = File.expand_path( @name )
58
- if FileTest.exists? @name
58
+ if FileTest.exist? @name
59
59
  @lines = IO.readlines( @name )
60
60
  if ( @lines.length == 0 ) || ( @lines[ -1 ][ -1..-1 ] == "\n" )
61
61
  @lines.push ""
@@ -21,8 +21,8 @@ module Diakonos
21
21
  if ! @testing
22
22
  @diakonos_conf = @config_filename || "#{@diakonos_home}/diakonos.conf"
23
23
 
24
- if ! FileTest.exists?( @diakonos_conf )
25
- if FileTest.exists?( @global_diakonos_conf )
24
+ if ! FileTest.exist?( @diakonos_conf )
25
+ if FileTest.exist?( @global_diakonos_conf )
26
26
  puts "No personal configuration file found."
27
27
  puts "Would you like to copy the system-wide configuration file (#{@global_diakonos_conf}) to use"
28
28
  $stdout.print "as a basis for your personal configuration (recommended)? (y/n)"; $stdout.flush
@@ -43,7 +43,7 @@ module Diakonos
43
43
  puts "You download one from https://git.sr.ht/~pistos/diakonos/blob/master/diakonos.conf"
44
44
  end
45
45
 
46
- if ! FileTest.exists?( @diakonos_conf )
46
+ if ! FileTest.exist?( @diakonos_conf )
47
47
  puts "Terminating due to lack of configuration file."
48
48
  exit 1
49
49
  end
@@ -161,7 +161,7 @@ module Diakonos
161
161
 
162
162
  # @return [ConfigFile, ConfigFileUnreadable]
163
163
  def legitimize_config_filename!(prospective_filename, including_config_file)
164
- if File.exists?(prospective_filename)
164
+ if File.exist?(prospective_filename)
165
165
  ConfigFile.new(
166
166
  File.realpath(prospective_filename),
167
167
  including_config_file
@@ -200,7 +200,7 @@ module Diakonos
200
200
  case command
201
201
  when "include"
202
202
  self.parse_configuration_file( File.expand_path( arg ), config_file )
203
- when 'load_extension'
203
+ when "load_extension"
204
204
  @extensions.load( arg ).each do |conf_file|
205
205
  parse_configuration_file conf_file
206
206
  end
@@ -327,6 +327,7 @@ module Diakonos
327
327
  when "context.separator", /^lang\..+?\.indent\.ignore\.charset$/,
328
328
  /^lang\.(.+?)\.tokens\.([^.]+)\.change_to$/,
329
329
  /^lang\.(.+?)\.column_delimiters$/,
330
+ /^extension\.(.+?)\.(.+?)/,
330
331
  "view.nonfilelines.character",
331
332
  'diff_command', 'session.default_session',
332
333
  'clipboard.external'
@@ -184,6 +184,7 @@ module Diakonos
184
184
  filename = nil
185
185
  do_open = false
186
186
  else
187
+ # TODO: Maybe a bug here, re: paths relative to session dir (external file find)
187
188
  existing_buffer = @buffers.find { |b| b.name == filename }
188
189
  end
189
190
 
@@ -304,13 +305,14 @@ module Diakonos
304
305
  directories: @session.dir,
305
306
  ceiling: @settings['fuzzy_file_find.max_files'] || 8192,
306
307
  ignores: @fuzzy_ignores,
307
- recursive: @settings['fuzzy_file_find.recursive']
308
+ recursive: @settings['fuzzy_file_find.recursive'],
309
+ sorted: true
308
310
  )
309
311
 
310
312
  finder_block = lambda { |input|
311
313
  break if input =~ %r{^/}
312
314
 
313
- matches = finder.find(input).sort_by { |m| m[:path] }
315
+ matches = finder.find(input)
314
316
  with_list_file do |list|
315
317
  list.puts matches.map { |m| m[:path] }
316
318
  end
@@ -120,6 +120,7 @@ module Diakonos
120
120
  end
121
121
 
122
122
  def redraw_input
123
+ # TODO: Gracefully handle when `input` is nil
123
124
  input = @input[ @view_y...(@view_y + Curses::cols) ]
124
125
 
125
126
  curx = @window.curx
@@ -249,7 +249,7 @@ module Diakonos
249
249
  end
250
250
 
251
251
  def cleanup_session
252
- if @session && Session.pid_session?(@session.filename) && File.exists?(@session.filename)
252
+ if @session && Session.pid_session?(@session.filename) && File.exist?(@session.filename)
253
253
  File.delete @session.filename
254
254
  end
255
255
  end
@@ -125,9 +125,11 @@ class FuzzyFileFinder
125
125
  @roots = root_dirnames.map { |d| Directory.new(d, true) }
126
126
  @shared_prefix = determine_shared_prefix
127
127
  @shared_prefix_re = Regexp.new("^#{Regexp.escape(shared_prefix)}" + (shared_prefix.empty? ? "" : "/"))
128
+ @sorted = params[:sorted]
128
129
 
129
130
  @files = []
130
131
  @directories = {} # To detect link cycles
132
+ @dirs_with_many = []
131
133
 
132
134
  rescan!
133
135
  end
@@ -201,11 +203,17 @@ class FuzzyFileFinder
201
203
  # Array. If +max+ is nil, all matches will be returned.
202
204
  def find(pattern, max=nil)
203
205
  results = []
206
+
204
207
  search(pattern) do |match|
205
208
  results << match
206
209
  break if max && results.length >= max
207
210
  end
208
- return results
211
+
212
+ if @sorted
213
+ results.sort_by { |m| m[:path] }
214
+ else
215
+ results
216
+ end
209
217
  end
210
218
 
211
219
  # Displays the finder object in a sane, non-explosive manner.
@@ -222,9 +230,22 @@ class FuzzyFileFinder
222
230
  if ! @directories[real_dir]
223
231
  @directories[real_dir] = true
224
232
 
225
- Dir.entries(directory.name).each do |entry|
233
+ Dir.entries(directory.name)
234
+ .tap { |_entries|
235
+ if _entries.length > ceiling/10
236
+ @dirs_with_many << [_entries.length, directory.name]
237
+ $diakonos.log "[#{self.class}] Many dir entries: #{_entries.length} in #{directory.name}"
238
+ end
239
+ }.each do |entry|
226
240
  next if entry[0,1] == "."
227
- raise TooManyEntries if files.length > ceiling
241
+ if files.length > ceiling
242
+ raise TooManyEntries.new(%{
243
+ Directories with many entries:
244
+
245
+ #{@dirs_with_many.map { |d| d.join("\t") }.join("\n")}
246
+
247
+ })
248
+ end
228
249
 
229
250
  full = File.join(directory.name, entry)
230
251
  next if ignore?(full)
@@ -1,6 +1,6 @@
1
1
  module Diakonos
2
- VERSION = '0.9.8'
3
- LAST_MODIFIED = 'September 20, 2020'
2
+ VERSION = '0.9.9'
3
+ LAST_MODIFIED = '2023-03-07'
4
4
 
5
5
  def self.parse_version( s )
6
6
  if s
data/lib/diakonos.rb CHANGED
@@ -6,9 +6,9 @@
6
6
  # :title: Diakonos
7
7
  #
8
8
  # Author:: Pistos
9
- # Copyright (c) 2004-2021 Pistos
9
+ # Copyright (c) 2004-2023 Pistos
10
10
  #
11
- # This software is released under the MIT licence.
11
+ # This software is released under the GNU GPL licence v3.
12
12
  # See the LICENCE file included with this program, or
13
13
  # http://www.opensource.org/licenses/mit-license.php
14
14
  #
@@ -237,7 +237,7 @@ module Diakonos
237
237
  end
238
238
 
239
239
  def mkdir( dir )
240
- if ! FileTest.exists?( dir )
240
+ if ! FileTest.exist?( dir )
241
241
  Dir.mkdir dir
242
242
  end
243
243
  end
@@ -473,7 +473,7 @@ module Diakonos
473
473
  FileUtils.rmdir d
474
474
  rescue Errno::ENOTEMPTY
475
475
  end
476
- if File.exists? d
476
+ if File.exist? d
477
477
  $stderr.puts "(#{d} not removed)"
478
478
  end
479
479
  end
@@ -550,7 +550,7 @@ module Diakonos
550
550
  tagfile = "./tags"
551
551
  end
552
552
 
553
- if ! FileTest.exists? tagfile
553
+ if ! FileTest.exist? tagfile
554
554
  set_iline "(tags file not found)"
555
555
  else
556
556
  IO.foreach( tagfile ) do |line_|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diakonos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pistos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-18 00:00:00.000000000 Z
11
+ date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.1
19
+ version: 1.4.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.4.1
26
+ version: 1.4.4
27
27
  description: Diakonos is a console text editor for the masses.
28
28
  email: diakonos dawt pistos aet purepistos dawt net
29
29
  executables:
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubygems_version: 3.2.26
168
+ rubygems_version: 3.4.10
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: Console text editor for the masses