Comments (5)
The crash is caused by view.wrap_count(line_no)
call when given too large line_no
. The original reason for this is that in wrapping mode active_view.first_visible_line
does not report the line number seen as line number in the line numbering margin, but some other value which is much higher and changes when scrolling one line at a time by values like for example 10 or 15 at a time.
In other words the crash occurs because view.first_visible_line
does not report the actual first visible line number seen in the line numbering margin with switched on line wrapping.
Is it a bug or a feature that view.first_visible_line
does not provide the right line number if wrapping is switched on? How to detect if wrapping is active from within Lua code in user init.lua
?
from textadept.
I haven't looked at your code, but my first instinct is that you need to call view:doc_line_from_visible(view.first_visible_line)
to get the actual document/buffer line number from the one displayed/visible. This is a feature of Scintilla, not a bug.
from textadept.
OK ... So view.first_visible_line
gives a line number which is the result of counting lines as they would appear in the view on screen. i.e. If an actual document line N (counted by newlines in the file of the loaded viewed text if the text was not yet changed) is wrapped into five lines, navigating to the last of these lines will give view.first_visible_line==N+4
where view:doc_line_from_visible(view.first_visible_line)==N
will still give the in the line numbering margin shown line number N.
In other words, switching line wrapping ON results in converting the entire viewed buffer text into wrapped text, not only the part which is visible in the view, right? So wrapping lines in case of very large documents will result in making the CPU busy with recalculating all the line numbers in the entire document and should be avoided as not practicable, right?
Further in other words, if I want wrapping of long lines in texts with a huge amount of long lines I need to implement it on my own and take full control of what is displayed in the view, no matter the actual content of the viewed text, right?
from textadept.
Your understanding is correct. I doubt you can "tak[e] full control of what is displayed in the view" though. Scintilla (via GUI widget) has its own way of displaying/laying out text that Textadept does not interfere with.
from textadept.
Thanks for the hint towards view:doc_line_from_visible(view.first_visible_line)
. This is a perfect starting point for "print()-based" debugging and understanding what is going on with the side-effect of solving the problem which was the reason for opening this issue. That the application shouldn't crash given a wrong value for a line number is another topic I am currently not ready to cope with.
from textadept.
Related Issues (20)
- `events.connect(events.LEXER_LOADED,...)` strange behaviour in nightly HOT 2
- Cannot load built-in modules on macOS HOT 2
- how to make current line number have a different color? HOT 5
- ui.print_silent_to() doesn't update the Tab label HOT 1
- lua interpeter scope not working properly HOT 7
- Going for new style snippets, I can't makethem work as per documentation HOT 2
- Problem expanding snippet with $0 HOT 4
- HTML doc files missing from source archive HOT 6
- Feature Request: Help in curses mode should show md files HOT 4
- Textadept Windows support history HOT 1
- lfs.walk() hangs when passed a non-existent directory path. HOT 1
- Building nightly failed on target `termkey-populate` HOT 4
- Stack overflow error with Linux release v12.4 HOT 4
- Closing a non-active buffer via the tab button switches the active buffer when it shouldn't. HOT 2
- Textadept freezes on large csv file HOT 14
- open normal html file and it gives error HOT 6
- not able to open this file HOT 1
- Buggy text in terminal version when maximizing HOT 2
- Suggestion for Find & Replace HOT 4
- 12.4 build failure: invalid use of incomplete typedef ‘WINDOW’ {aka ‘struct _win_st’} HOT 3
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.