Replies: 8 comments 6 replies
-
With regex enabled, try '$'. It's supposed to match the EOL.
|
Beta Was this translation helpful? Give feedback.
-
It's possible that there's a bug here. I will look into it more when I have some time. In the meantime, you can input the following into the Lua command entry:
if buffer.selection_empty then buffer:set_text((buffer:get_text():gsub('\n',','))) else buffer:replace_sel((buffer:get_sel_text():gsub('\n',','))) end
If no text is selected, replace all newlines with ',' and if there is text selected, replace '\n' in only that text with ','
|
Beta Was this translation helpful? Give feedback.
-
Oh nice, I didn't realize you were on Linux. Yes, shell commands to the rescue. Nicely done!
|
Beta Was this translation helpful? Give feedback.
-
That works, as does assigning a key to:
function() textadept.editing.filter_through("tr '\n' ',') end
`textadept.editing.filter_through()` handles selections a bit better in my opinion[1].
[1]: https://orbitalquark.github.io/textadept/api.html#textadept.editing.filter_through
|
Beta Was this translation helpful? Give feedback.
-
Okay, I've fixed the underlying bug via 57d946f
You can now "Replace All" with empty regex matches like '$', '^', etc.
|
Beta Was this translation helpful? Give feedback.
-
In regex, '$' actually means match the position at the end-of-line, not the EOL itself, so the search and replace you are seeing is the expected behavior. Scintilla's built-in regex does not allow multi-line matches, so squashing multiple lines onto one with a regex is not possible, hence the need for Lua scripts or filter-through.
Finding '^.*$' seems to work for me given the 'abc\ndef\nghi' string you gave, both in 11.2 and 11.3 beta.
I don't know what regex Geany uses, but Textadept uses Scintilla's built-in C++11 regex capabilities.
Given the age of this discussion, I'm not sure if there's a regression here or not. Please let me know if you find one. My unit tests and manual tests are passing right now.
|
Beta Was this translation helpful? Give feedback.
-
Thanks, I see now. It's an issue of Find vs. Find Incremental. The latter advances the search, but the former does not. I'll look into this when I have some time.
|
Beta Was this translation helpful? Give feedback.
-
This should be fixed via f813166
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I've been trying to match a newline character (\n) using the Search dialog but to no avail: I've tried both the normal search and the Regex search with \n and always get No results found. I'm on Linux with Textadept v. 11.1.
Is there a special syntax to match newlines and other escape sequences in Textadept?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions