[Github-comments] Re: [geany/geany] Indentation on pasting of a multiline text (Issue #3845)
And what about pasting Python (or other offside languages)? Are we pasting: 1. _at_ the levels indicated by the clipboard indentation, or 2. _at_ the level at the cursor, or 3. _into_ the level at the cursor? So just taking deltas into account is still not enough because of 2. vs 3. Too many choices, but the current behaviour of re-indenting the first line only is likely to be wrong most of the time and probably should be changed for multi-line pastes. -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/3845#issuecomment-2067502068 You are receiving this because you are subscribed to this thread. Message ID:
[Github-comments] Re: [geany/geany] Fix invalid memory access and Unicode support in utils_get_initials() (PR #3846)
@elextr requested changes on this pull request. Neat. Its not perfect (eg Indic combining chars have class 0), but at least it should not result in invalid strings and the user can always override it with the preference. > @@ -766,21 +766,47 @@ gchar *utils_get_date_time(const gchar *format, time_t > *time_to_use) } +/* Extracts initials from @p name, with some Unicode support */ +GEANY_EXPORT_SYMBOL If its exported it should be documented ? > gchar *utils_get_initials(const gchar *name) { - gint i = 1, j = 1; - gchar *initials = g_malloc0(5); + GString *initials; + gchar *composed; + gboolean at_bound = TRUE; + gboolean prev_matched = FALSE; + + g_return_val_if_fail(name != NULL, NULL); + + composed = g_utf8_normalize(name, -1, G_NORMALIZE_DEFAULT_COMPOSE); I suspect it should be `G_NORMALIZE_ALL_COMPOSE` so composite characters get split and other compatibility transforms. (==NFKC?). I am unsure if (for example) ligatures can occur as first letters of names, and if they do is the "initial" the ligature or the first letter of it? Currently it selects the ligature as the "initial". Anyway its not critical so long as the user can override it with the "initials" preference. -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/3846#pullrequestreview-2012843161 You are receiving this because you are subscribed to this thread. Message ID:
[Github-comments] Re: [geany/geany] Indentation on pasting of a multiline text (Issue #3845)
> Even if this doesn't get implemented, I'd love to hear why this is not a > desired behavior :) I think it's an interesting (and probably useful) behavior, but it probably also cannot be the default. Here are a couple of reasons why from the top of my head: * What currently happens is that the pasted text is inserted as-is in the file -- not "pasted at column 0" if you will. This means that you get exactly what the content of the clipboard was inserted where you asked, which is great for predictability, as well as handling all case a "smart" algorithm might get wrong. * What if the clipboard already *has* indentation for the subsequent lines? * Strip the common indentation from all lines in the clipboard, and add back the one at the current position? * What about empty lines in the clipboard, do they count as "0-length indentation" or "let's ignore this line" * Or maybe strip the indentation from the first clipboard line, and then add `(current - delta_from_first_line)`? (e.g. aiming for the first line's indent to be the current position's indent, and then adding and removing indentation to match the differences in the pasted content) * And then, how to make up what an "indentation level" is in the clipboard? Is it the same size as the current document's? Or is it inferred from the clipboard? * But then, what if you copied only a partial first line rather than the whole thing? then applying delta is basically yielding the same as not changing anything. * Strip all indentation from the clipboard and past it all at the same level? * Simply prepend the current position's indentation to all lines without stripping anything from the clipboard? All that might or might not make sense I guess, depending on the situation. I *guess* the "best" algorithm is one that takes clipboard indentation deltas into account and applies them, but it's also the most complex and could get things wrong. --- As a currently available workaround (which you might already know about), you can easily adjust indentation of a whole series of lines by selecting it and using Tab or Shift+Tab. -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/3845#issuecomment-2067343536 You are receiving this because you are subscribed to this thread. Message ID:
[Github-comments] Re: [geany/geany] Fix read past end of string in utils_get_initials() (PR #3844)
Good find! But I believe the fix, although not bad (despite me not liking the `strlen()` use here, but that hardly matters) is not nearly enough. This function is also *terrible* with non-ASCII handling, to the point where it does more harm than good. I propose an alternate (yet a bit over-the-top) fix in #3846. -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/3844#issuecomment-2067304635 You are receiving this because you are subscribed to this thread. Message ID:
[Github-comments] [geany/geany] Fix invalid memory access and Unicode support in utils_get_initials() (PR #3846)
Fix utils_get_initials() reading past the end of the input string if that string was empty. Also fix support for non-ASCII initials for which the UTF-8 character representation would have been truncated to the first byte only, leading to an invalid value. The implementation here also tries to handle combining accents, although that part might not be really solid. Fixes #3844. --- This might get a bit over-the-top with the support for non-composable combining marks, but well, now its there? :) You can view, comment on, or merge this pull request online at: https://github.com/geany/geany/pull/3846 -- Commit Summary -- * Fix invalid memory access and Unicode support in utils_get_initials() -- File Changes -- M src/utils.c (42) M tests/test_utils.c (23) -- Patch Links -- https://github.com/geany/geany/pull/3846.patch https://github.com/geany/geany/pull/3846.diff -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/3846 You are receiving this because you are subscribed to this thread. Message ID: geany/geany/pull/3...@github.com
[Github-comments] [geany/geany] Indentation on pasting of a multiline text (Issue #3845)
Hi, let me start with an expression of gratitude for this great text editor! This is a feature request: Scenario steps: 1. Have a file with some text already in it. 2. Have the text be hierarchically organized by indentation levels 3. Be on a level 2 4. Paste a multiline text from the clipboard Current behavior: The first line of the text is pasted at the cursor location. (indented on level 2) All the other lines of the clipboard contents are pasted at column 0 (indentation level 1). Desired behavior: Have all the lines of the pasted clipboard text be "padded" with the indentation level of the cursor. e.g. ``` Intro: This text is indented on level 2 Other section: This text is also indented on level 2 # now I wish to paste a multiline text from the clipboard and have _all_ of the text indented to the "Level 1" (whatever that is, e.g. 1 tab) ``` Thanks in advance! Even if this doesn't get implemented, I'd love to hear why this is not a desired behavior :) -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/3845 You are receiving this because you are subscribed to this thread. Message ID:
[Github-comments] Re: [geany/geany-themes] Where is the Windows' Geany's color scheme saved (Issue #72)
The [manual](https://www.geany.org/manual/current/index.html#configuration-file-paths) tells you where Geany is looking. -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany-themes/issues/72#issuecomment-2066279241 You are receiving this because you are subscribed to this thread. Message ID: