Comments (8)
What do you mean by fails?
The current behaviour is that is selects the nearest selectable text position (so it would snap to the beginning or end of a hard tab). Is that not what you are experiencing?
from atom-sublime-select.
Well, it depends what you call "selectable". Here, it works perfect with all lines that don't contains "tab" character like on last 3 lines of my sample.
Try it, type 123456 and then , 123456 and last type 123456. Selection on third line don't works as espected.
Please let me know if you can't reproduce behavior then I can try to make a video.
Btw, good job. This extension is what is missing on default Atom instalation!
from atom-sublime-select.
I use tabs that are 4 positions (spaces) wide. Actual tabs, not tabs-to-spaces.
When I attempt to use column selection on lines that contain tabs, it calculates the correct column positions from which to select, but then applies that as a character position (with a tab counting as a single character).
from atom-sublime-select.
I think there should be an option always keep a rectangular selection, never selecting anything past the mouse cursor's column, and additionally selecting rows and columns where text doesn't exist.
from atom-sublime-select.
Oh I see!
Yeah I'm able to replicate that.
I would actually consider that a bug in the atom API. It doesn't consider tab size when reporting columns, or setting ranges by column number.
I'll have a look through the API and see if there is another way that takes hard-tabs into consideration, otherwise I'll have a look at detecting the number of hard-tabs on each line that is selected and accounting for them when handling column numbers (eek).
from atom-sublime-select.
I looked into the TextBuffer API methods and didn't find anything that might be useful here besides the methods you're already using. I do have some rough draft logic in place that attempts to calculate the correct placement. I haven't looked into a way to retrieve the user's tab settings, but I suspect that won't be too hard - for now, it's hard-coded to 4-width hard tabs.
It's messy, but it's an improvement over the current behavior in terms of hard tab environments. I'll put up a gist tomorrow and hopefully it'll provide a decent starting point for building out a more robust selection handler.
from atom-sublime-select.
Actually I just released a new patch that should fix this.
I was confusing buffer ranges with screen ranges.
As far as I can tell:
buffer column = number of text characters from the left
screen column = number of mono spaced columns from the left
Atom API has a nice bufferRangeForScreenRange method. Hey presto!
from atom-sublime-select.
Hah! That's exactly what I planned on writing myself to clean up my code. Fantastic.
from atom-sublime-select.
Related Issues (20)
- Feature request: Column paste HOT 1
- won't install HOT 2
- When Atom is restarted, I need to switch tabs before columns selection works HOT 1
- Text buffer decorations causes ALT + LMB selections to start at wrong location HOT 1
- "sublime needs to install dependencies"
- Installing is returning a 400 error
- Update README to link to multi-cursor plugin?
- Not downloading
- install never completes HOT 1
- Can't edit what I have selected HOT 5
- atom-subline-selection HOT 1
- Installing sublime-style-column-selection HOT 3
- install not launching HOT 2
- Stuck on install
- Feature request / Bug: ignore multiline template literal strings
- The following package isnt installing HOT 1
- Deleted.
- The "Alt" modifier key does not work, because Alt is bound to menu's. HOT 1
- installation is hanging
- Issue downloading Sublime-Style-Column-Selection HOT 1
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 atom-sublime-select.