suplemon-editor 0.3.1__tar.gz → 0.3.3__tar.gz

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.
Files changed (78) hide show
  1. {suplemon_editor-0.3.1/suplemon_editor.egg-info → suplemon_editor-0.3.3}/PKG-INFO +23 -1
  2. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/README.md +22 -0
  3. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/main.py +17 -5
  4. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3/suplemon_editor.egg-info}/PKG-INFO +23 -1
  5. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/LICENSE +0 -0
  6. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/MANIFEST.in +0 -0
  7. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/setup.cfg +0 -0
  8. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/setup.py +0 -0
  9. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/__init__.py +0 -0
  10. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/__main__.py +0 -0
  11. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/cli.py +0 -0
  12. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/config/defaults.json +0 -0
  13. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/config/keymap.json +0 -0
  14. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/config.py +0 -0
  15. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/cursor.py +0 -0
  16. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/editor.py +0 -0
  17. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/file.py +0 -0
  18. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/help.py +0 -0
  19. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/helpers.py +0 -0
  20. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/hex2xterm.py +0 -0
  21. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/key_mappings.py +0 -0
  22. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/lexer.py +0 -0
  23. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/line.py +0 -0
  24. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/__init__.py +0 -0
  25. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/color_map.py +0 -0
  26. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/css.py +0 -0
  27. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/diff.py +0 -0
  28. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/html.py +0 -0
  29. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/js.py +0 -0
  30. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/json.py +0 -0
  31. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/lua.py +0 -0
  32. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/md.py +0 -0
  33. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/php.py +0 -0
  34. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/linelight/py.py +0 -0
  35. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/logger.py +0 -0
  36. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/module_loader.py +0 -0
  37. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/application_state.py +0 -0
  38. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/autocomplete.py +0 -0
  39. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/autodocstring.py +0 -0
  40. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/battery.py +0 -0
  41. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/bulk_delete.py +0 -0
  42. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/clock.py +0 -0
  43. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/comment.py +0 -0
  44. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/config.py +0 -0
  45. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/date.py +0 -0
  46. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/diff.py +0 -0
  47. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/eval.py +0 -0
  48. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/hostname.py +0 -0
  49. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/input_test.py +0 -0
  50. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/keymap.py +0 -0
  51. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/linter.py +0 -0
  52. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/lower.py +0 -0
  53. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/lstrip.py +0 -0
  54. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/paste.py +0 -0
  55. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/reload.py +0 -0
  56. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/replace_all.py +0 -0
  57. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/reverse.py +0 -0
  58. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/rstrip.py +0 -0
  59. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/save.py +0 -0
  60. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/save_all.py +0 -0
  61. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/sort_lines.py +0 -0
  62. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/strip.py +0 -0
  63. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/system_clipboard.py +0 -0
  64. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/tabstospaces.py +0 -0
  65. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/toggle_whitespace.py +0 -0
  66. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/modules/upper.py +0 -0
  67. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/prompt.py +0 -0
  68. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/suplemon_module.py +0 -0
  69. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/themes/8colors.tmTheme +0 -0
  70. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/themes/monokai.tmTheme +0 -0
  71. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/themes.py +0 -0
  72. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/ui.py +0 -0
  73. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon/viewer.py +0 -0
  74. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon_editor.egg-info/SOURCES.txt +0 -0
  75. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon_editor.egg-info/dependency_links.txt +0 -0
  76. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon_editor.egg-info/entry_points.txt +0 -0
  77. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon_editor.egg-info/requires.txt +0 -0
  78. {suplemon_editor-0.3.1 → suplemon_editor-0.3.3}/suplemon_editor.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: suplemon-editor
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: Console text editor with multi cursor support. Maintained fork of Suplemon.
5
5
  Home-page: https://github.com/leancode/suplemon/
6
6
  Author: Richard Lewis
@@ -183,6 +183,28 @@ externally managed (PEP 668) and will refuse `sudo pip install` outright.
183
183
  suplemon [filename:row:col]... # Open one or more files at a specific row or column (optional)
184
184
 
185
185
 
186
+ ### Editing a root-owned file
187
+
188
+ `sudo suplemon /etc/hosts` will say `command not found`. That is sudo, not
189
+ Suplemon: sudo replaces `$PATH` with its own `secure_path`, which never
190
+ includes `~/.local/bin`, so it cannot see the launcher. Give it the full
191
+ path instead:
192
+
193
+ sudo ~/.local/bin/suplemon /etc/hosts
194
+
195
+ That works because the launcher hard-codes an absolute path to the source
196
+ tree. `$HOME` is root's under sudo, so a launcher written in terms of
197
+ `$HOME` would look for the interpreter in the wrong place.
198
+
199
+ If you do this often, either add `~/.local/bin` to `secure_path` in
200
+ `visudo`, or use `sudoedit`, which copies the file to a temporary location,
201
+ opens it as you rather than as root, and copies it back:
202
+
203
+ SUDO_EDITOR=~/.local/bin/suplemon sudoedit /etc/hosts
204
+
205
+ `sudoedit` is the safer of the two: the editor never runs as root.
206
+
207
+
186
208
  ### Notes
187
209
  - **Python 3.8 or higher.** Python 2 is not supported.
188
210
  - *The master branch is considered stable.*
@@ -142,6 +142,28 @@ externally managed (PEP 668) and will refuse `sudo pip install` outright.
142
142
  suplemon [filename:row:col]... # Open one or more files at a specific row or column (optional)
143
143
 
144
144
 
145
+ ### Editing a root-owned file
146
+
147
+ `sudo suplemon /etc/hosts` will say `command not found`. That is sudo, not
148
+ Suplemon: sudo replaces `$PATH` with its own `secure_path`, which never
149
+ includes `~/.local/bin`, so it cannot see the launcher. Give it the full
150
+ path instead:
151
+
152
+ sudo ~/.local/bin/suplemon /etc/hosts
153
+
154
+ That works because the launcher hard-codes an absolute path to the source
155
+ tree. `$HOME` is root's under sudo, so a launcher written in terms of
156
+ `$HOME` would look for the interpreter in the wrong place.
157
+
158
+ If you do this often, either add `~/.local/bin` to `secure_path` in
159
+ `visudo`, or use `sudoedit`, which copies the file to a temporary location,
160
+ opens it as you rather than as root, and copies it back:
161
+
162
+ SUDO_EDITOR=~/.local/bin/suplemon sudoedit /etc/hosts
163
+
164
+ `sudoedit` is the safer of the two: the editor never runs as root.
165
+
166
+
145
167
  ### Notes
146
168
  - **Python 3.8 or higher.** Python 2 is not supported.
147
169
  - *The master branch is considered stable.*
@@ -6,6 +6,7 @@ The main class that starts and runs Suplemon.
6
6
 
7
7
 
8
8
  import os
9
+ import curses
9
10
  import sys
10
11
 
11
12
  from . import ui
@@ -18,7 +19,13 @@ from .logger import logger
18
19
  from .config import Config
19
20
  from .editor import Editor
20
21
 
21
- __version__ = "0.3.1"
22
+ __version__ = "0.3.3"
23
+
24
+
25
+ # ncurses only defines BUTTON5 when built with NCURSES_MOUSE_VERSION 2.
26
+ # Without it there is no wheel-down event to match, so scrolling down is
27
+ # simply unavailable rather than mismatched.
28
+ BUTTON5_PRESSED = getattr(curses, "BUTTON5_PRESSED", 0)
22
29
 
23
30
 
24
31
  class App:
@@ -340,13 +347,18 @@ class App:
340
347
  :rtype: boolean
341
348
  """
342
349
  editor = self.get_editor()
343
- if event.mouse_code == 1: # Left mouse button release
350
+ code = event.mouse_code
351
+ # These were hardcoded integers matching NCURSES_MOUSE_VERSION 1,
352
+ # which gave each button six bits. Version 2 packs them into five to
353
+ # make room for button 5, so every value except BUTTON1_RELEASED
354
+ # moved and only left click still worked. Ask curses instead.
355
+ if code & curses.BUTTON1_RELEASED:
344
356
  editor.set_single_cursor(event.mouse_pos)
345
- elif event.mouse_code == 4096: # Right mouse button release
357
+ elif code & curses.BUTTON3_RELEASED:
346
358
  editor.add_cursor(event.mouse_pos)
347
- elif event.mouse_code == 524288: # Wheel up
359
+ elif code & curses.BUTTON4_PRESSED: # Wheel up
348
360
  editor.jump_up()
349
- elif event.mouse_code == 134217728: # Wheel down(and unfortunately left button drag)
361
+ elif BUTTON5_PRESSED and code & BUTTON5_PRESSED:
350
362
  editor.jump_down()
351
363
  else:
352
364
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: suplemon-editor
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: Console text editor with multi cursor support. Maintained fork of Suplemon.
5
5
  Home-page: https://github.com/leancode/suplemon/
6
6
  Author: Richard Lewis
@@ -183,6 +183,28 @@ externally managed (PEP 668) and will refuse `sudo pip install` outright.
183
183
  suplemon [filename:row:col]... # Open one or more files at a specific row or column (optional)
184
184
 
185
185
 
186
+ ### Editing a root-owned file
187
+
188
+ `sudo suplemon /etc/hosts` will say `command not found`. That is sudo, not
189
+ Suplemon: sudo replaces `$PATH` with its own `secure_path`, which never
190
+ includes `~/.local/bin`, so it cannot see the launcher. Give it the full
191
+ path instead:
192
+
193
+ sudo ~/.local/bin/suplemon /etc/hosts
194
+
195
+ That works because the launcher hard-codes an absolute path to the source
196
+ tree. `$HOME` is root's under sudo, so a launcher written in terms of
197
+ `$HOME` would look for the interpreter in the wrong place.
198
+
199
+ If you do this often, either add `~/.local/bin` to `secure_path` in
200
+ `visudo`, or use `sudoedit`, which copies the file to a temporary location,
201
+ opens it as you rather than as root, and copies it back:
202
+
203
+ SUDO_EDITOR=~/.local/bin/suplemon sudoedit /etc/hosts
204
+
205
+ `sudoedit` is the safer of the two: the editor never runs as root.
206
+
207
+
186
208
  ### Notes
187
209
  - **Python 3.8 or higher.** Python 2 is not supported.
188
210
  - *The master branch is considered stable.*
File without changes