MoveTab icon indicating copy to clipboard operation
MoveTab copied to clipboard

Don't cycle tab position by default anymore (and a few other cleanups)

Open FichteFoll opened this issue 11 months ago • 5 comments

Closes #2.

I'm breaking compatibility with older ST builds here because I believe they are not worth maintaining, so I created a PC PR for this: https://github.com/wbond/package_control_channel/pull/8886 Tags are already pushed.

I chose to make behavior configurable via a command parameter because a setting would have been overkill and because you may want to have both modes simultaneously.

FichteFoll avatar Mar 10 '24 13:03 FichteFoll

I've forked this repo to https://github.com/deathaxe/MoveView years ago to

  1. add ListInputHandler for targets
  2. create commands which align better with ST's built-in commands.

I never liked those string arguments here. Mixing them up with integers doesn't improve it.

deathaxe avatar Mar 10 '24 13:03 deathaxe

If compatibility is not an issue and separate commands as in MoveView are not desired, the API should IMHO at least look a bit more ST like by

Move tab relative

{ "command": "move_tab", "args": {"by": -1, "cycle": false} }

Move tab to absolute position counting from first tab onwards

{ "command": "move_tab", "args": {"to": 5} }

Move tab to absolute position counting from last tab backwards

{ "command": "move_tab", "args": {"to": -5} }

deathaxe avatar Mar 10 '24 16:03 deathaxe

If compatibility is not an issue

That is indeed the biggest question here. So far, aside from the cycling behavior, my changes are backwards compatible, but I agree that we can use this opportunity to make more changes

I suspect that most users just use the default key bindings and haven't added their own. Even then, I could provide a backwards compatibility argument which would ensure everything works exactly as before when the old position argument is used.

I'll think about it for a bit.

FichteFoll avatar Mar 10 '24 17:03 FichteFoll

I attempted to utilize this branch and encountered the following error:

reloading python 3.3 plugin move_tab
Traceback (most recent call last):
  File "/opt/sublime_text/Lib/python33/sublime_plugin.py", line 308, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 853, in _load_module
  File "<frozen importlib._bootstrap>", line 980, in get_code
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "/home/giovanni/.config/sublime-text/Packages/move_tab.py", line 22
    if not (view := self.window.active_view()):
                 ^
SyntaxError: invalid syntax

I am uncertain why my Sublime Text editor - Build 4169, appears to be using Python 3.3. I'm on Pop!_OS 22.04 LTS. Any insights or suggestions on resolving this issue would be greatly appreciated.

gioisco avatar Mar 10 '24 18:03 gioisco

It's controlled by .python-version file in root of the package.

That said, assignment expressions are of little value here.

deathaxe avatar Mar 10 '24 18:03 deathaxe