Comments (6)
There's probably an elegant way to solve it, but I haven't found it yet.
The elegant way is to correctly guess the users intent which is not really feasible. That's why I am using two different hotkeys for commenting. One for the default toggle and one to comment everything that is selected. Considering how rarely I use the latter this is acceptable to me.
Just for comparison, vscode doesn't seem very smart about commenting either. It will often double comment lines which is even more annoying than having two different hotkeys.
from textadept.
I'm also using a customized comment function that allows for this. At the time I was the only one who expressed interest in this, which is why I didn't really push for upstream integration.
It's implemented as an argument so both versions are possible. Additionally, my function inserts a space between the comment token and the text for added clarity.
The changes are minor but I'm still not sure it's worth to integrate into upstream since it is easily implemented in the local init.lua.
from textadept.
I can't reproduce the problem where toggling again doesn't restore the original.
When you "toggle comment" on a line that starts with a comment, I would expect that line to be uncommented, hence my comment. I'm not belittling your solution though. I was just hoping to try and come up with something more elegant that makes a bit more intuitive sense.
from textadept.
The one issue is if you start with a commented line and extend the selection to the line below, for example:
#foo
bar
When you toggle comment, you'll get this:
foo
ar
Toggling again gives you:
#foo
#ar
The idea of "toggle comment" is that every other time you invoke it, you should get back exactly what was there originally.
There's probably an elegant way to solve it, but I haven't found it yet.
from textadept.
The one issue is if you start with a commented line and extend the selection to the line below, for example:
#foo bar
When you toggle comment, you'll get this:
foo ar
Toggling again gives you:
#foo #ar
The idea of "toggle comment" is that every other time you invoke it, you should get back exactly what was there originally.
I can't reproduce the problem where toggling again doesn't restore the original.
Just for comparison, vscode doesn't seem very smart about commenting either. It will often double comment lines which is even more annoying than having two different hotkeys.
This patch tries to replicate VSCode's behaviour where it will double comment, it's really just a matter of taste at this point :)
from textadept.
Ah, thanks for clarifying.
from textadept.
Related Issues (20)
- Horizontal scrolling in textadept-curses HOT 2
- Error when saving in a Windows path localised region HOT 8
- Add iconv library for FreeBSD HOT 1
- Segfault on FreeBSD HOT 1
- 建议textadept增加简体中文 HOT 1
- Multiple cursors disappear on undo & redo HOT 7
- ui.dialogs.input too small and not resizable HOT 1
- Tabs Management HOT 1
- buffer:set_encoding('UTF-8') causes marking buffer as changed HOT 5
- Compilation on Ubuntu 18.04 failed when trying to build scintilla HOT 3
- Making syntax highlighting in Textadept providing features supported in SciTE Python lexer HOT 7
- Alternative download site for current Textadept files HOT 2
- Request change of behaviour for rectangular selection to ignore line ends HOT 2
- Latest textadept crashes on Win7 HOT 2
- HTML files missing from docs in 12.2-Linux release HOT 1
- When `~/.textadept/locale.conf` is present, **Edit** > **Preferences** followed by **Quick Open User Home** shows a single tab in the tab bar HOT 3
- Keypad / numpad's Enter sometimes doesn't behave like regular Enter/Return. HOT 1
- Crash on text-paste HOT 8
- Typing causes CPU heating at 500 lines 28 kByte large bash lexed file with large string areas. HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textadept.