When using the widget for editing source code, a feature would be helpful, which places the cursor to expected start position of the new line.
Feature definition:
--------------------
1. The automatic indention has only an influence to the Return-Key function (paste and programmed insert are not touched).
2. The indention mode should be configurable:
normal - like now, Return places the cursor at the begin of the new line.
automatic - new, Return places the cursor below the first non white space on the new line.
3. To be independent from using/not using tabs, all leading white spaces should be copied 1:1 at the begin of the new line.
Proposal for 'New Widget Options' description:
----------------------------------------------
-autoindent
Boolean parameter. If automatic indention is disabled, the cursor is placed at begin of the new line. If enabled, the cursor is placed below the first non white space on the new line.
Code modifications:
-------------------
The Return-Key event is handled in textplus.tcl. When changing at this position possible side-effects can be minimised.
tkText.c/tkText.h: Add code to define new parameter -autoindent and variable autoIndent.
textplus.tcl: Add code to ::TextPlus::Insert to handle "\n"
copy patch.txt and the three source files into one dir and execure patch < patch.txt