Sublime Text: How can I disable auto scrolling while I'm typing in the Find box? - sublimetext3

I am currently trying to write a complex regex for a huge file. Every time I type in the find input box to make a small change, Sublime scrolls me either to the top of the document or to a semi-random location (from what I can remember, it doesn't always scroll to the first match), even when there are matches where I'm already scrolled to in the file. It makes for a pretty painful workflow: I write down the line number on a piece of paper, edit my regex, and then have to "go-to" back to the line I was already at. How can I prevent this, or at the very least, does anybody know why exactly this is happening in the first place?

This is controlled by the Highlight Matches button in the Find and Find and Replace panels, and causes Sublime to show you all of the matches, highlighting one of them and outlining the remainder in a region to show you where they are.
The visual appearance of the button is controlled by the theme you use, but it's always in this position in the panel (and it should have the same icon in all other find panels as well); it also has a tooltip that tells you the name.
When the search term is modified and this option is turned on, Sublime jumps to a match, though this doesn't occur if the panel opens with an existing search term already in it; in that case matches are highlighted but the view doesn't change.
The option also exists in Incremental Find panel as well, but turning it off there only stops other matches from being highlighted as by definition Incremental Find is for jumping to a search term incrementally as you modify it.

Related

ST3: Find text results in panel instead of a buffer

I must have hit a setting in ST3 and caused my program to display results in a panel instead of in a buffer. How do I get it back so that find-text results go into their own tab? I've done some digging around but I can't find what I did.
In the Find in Files panel, there is a series of buttons to the left of the Find field, and the right most one of those is the one that controls whether the find results show up in a panel or in a buffer.
Note that the button may look different in your version as it appears that you're using a different theme (the image below shows the default theme). You can verify that you have the correct button based on the tool tip text.

Settings type «invisibles» and «shadow» in Sublime Text 3 .tmTheme file

I have read the documentation for the Color Schemes. I realized all settings except invisibles and shadow (+shadowWidth). I can translate from English, but I do not see anywhere where the elements, the color of which changes settings. Does anyone could show me the screenshots, where there are elements which change color? Thanks.
From the unofficial documentation on color schemes, linked to in your question, we can see that invisibles is ignored, so changing it has no effect on the appearance of any elements in ST3. The tmTheme format is borrowed from a different text editor, to make it easier to use the same color scheme in different editors. So maybe it does something in other text editors, but not in ST. EDIT: support for invisibles has been added to ST in build 3149 - https://github.com/SublimeTextIssues/Core/issues/1992.
The effect of the shadow setting can be seen below, it is the pink parts on the far sides:
It is only visible when the text in the document is wider than the window - it will appear on the left when the view can be scrolled to the left and it will appear on the right when the view can be scrolled to the right.
From my testing, including shadowWidth in the tmTheme file will cause the shadow to not appear. I have logged an issue in the unofficial documentation here, maybe someone will update it with details of how to get this working.
Note:
When making changes to atmTheme file, it is often necessary to close all open documents, and restart Sublime Text, before the change will become visible.

PyQt QTextEdit text selection without moving the cursor (like ubuntu terminal)

I've developed a shell (imitating the ubuntu terminal --> can only edit text after current prompt) by a PyQt QTextEdit.
The thing is when I select some text, the cursor moves as I'm selecting this text (so it disappers from the current command line) and I would like the cursor to stay where it is (only when I select text because I want it to move when I move it programmatically by textEdit.moveCursor(...)) at the same time I'm selecting the text.
Does anybody have any idea of how could I do that?
My solution for now, is to save the position at any change of it (except when it changes by a click), and when I copy some text en paste it, it'll be automatically pasted in the last position the cursor was before the click. That works perfectly but it's "ugly" for the user because, as I said, when he selects the text the cursor disappears of the current line and is where the user is selecting the text. Not like in ubuntu terminal.
Thanks in advance! And sorry for my english.
Adri
I don't see an easy solution to implement this with a text editor API. A terminal is a hack, basically. It mixes a read-only element (anything above the current prompt) with a text editor.
My approach would be to create two text editors, make one read only and display the results of all operations there. If you hide the borders of the two editors, then it will look like a single one. You may have to forward a bunch of events (like scrolling with the keyboard) to the read-only display.

How does Google Docs position the cursor when up or down keys are pressed?

Unlike most rich text editors on the web, Google Docs doesn't use contenteditable and instead uses its kix-editor. While moving the cursor on left/right presses is simple, how do they position their cursor when a user presses up or down?
For example, when a paragraph is multiple lines, how does the cursor know what is "above" it?
Or going up or down across multiple paragraphs, in a situation where there is an empty line between them and the cursor manages to save its horizontal positioning, despite the fact that the empty line forces it to move all the way to the left?
Looking at the DOM in Google Docs, it appears they do their own laying out. That is to say, they measure paragraph lengths and split them into separate divs. Therefore, the idea of iterating through the different ranges in the div "above" the currently selected div is a finite problem, instead of potentially an infinite one (if the previous paragraph is immensely long).

Browser Ctrl+F find non-visible text

Can the browser feature of Ctrl+F to find text be integrated with text in popup windows.
I'd like to have some scientific reference information given when someone hovers over a species name in a web page. Generating the popup, tooltip style text is no problem, the problem is that anyone using Ctrl+F won't be able to find it, or if I position the text out of view when not required, it will be found but be invisible.
The same sort of effect applies to "accordion" style expanding text areas.
I'm looking for some sort of event generated when find is highlighting a result.
Unfortunately there is no such event, you can't interfere with the built-in find.
About the best you can do in this case is to provide your own search function in-page, which searches the DOM for Text nodes containing the given text, highlights them, and opens up any closed accordions they're in.
The only idea I have, is to put all the text from your popups in one additional scrollbox (maybe at the bottom of the page) with a height just large enough to display one set of detail information at a time. This way, it doesn't take up too much space on the page, and the text can still be found using Ctrl+F.

Resources