geany / geany-plugins

The combined Geany Plugins collection
http://plugins.geany.org/
581 stars 262 forks source link

LaTeX: Switch handling of insert (list) environments over to snippets workflow #1330

Closed frlan closed 2 months ago

frlan commented 2 months ago

This MR migrates the feature to insert any environment over to Geany's snippets workflow. Hence we don't need to bother about indention, like breaks etc. this much anymore. Also due to the cursor-feature it ensures to position the cursor at the right place , independent from the line break, indention etc.

Due to this rework it makes the code also a little more readable and fixes #1071

frlan commented 2 months ago

Looks good.

As you know I'm not LaTeX expert and so I'm wondering if it is on purpose that different environments produce quite different stylings:

\begin{block}{}
_
\end{block}

\begin{itemize}
  \item _ 
\end{itemize}

\begin{table}
 _ 
\end{table}

For "table" and "itemize" there is a trailing space after the cursor marker. Is this intended?

"block" uses no indentation at all, "itemize" uses a tab resp. spaces and "table" uses a single space only.

This is fixed. I tried to re-sync the indentions

eht16 commented 2 months ago

For "table" and "itemize" there is a trailing space after the cursor marker. Is this intended? "block" uses no indentation at all, "itemize" uses a tab resp. spaces and "table" uses a single space only.

This is fixed. I tried to re-sync the indentions

I cannot verify as I do not know what is the purposed variant. To me it looks inconsistent: Screenshot_2024-04-26_18-38-28

More importantly, the rubbisch after the "block" environment is because g_strconcat() must always be NULL-terminated which it is not in the newly added code.

eht16 commented 2 months ago

Looks good now.

As said before, I cannot judge whether the result of the snippets is as desired. To me it feels a little confusing that the element in the "itemize" environment is indented while for the other ones the cursor position is not indented. Maybe it's ok.

frlan commented 2 months ago

In the end it's a little matter of taste, but compare it to HTML's

<ul>
  <li>...</li>
</ul>

and


<body>
…
</body>