Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding auto-indent feature #771

Merged
merged 5 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# next (unreleased)
* Copy/paste text into the correct text field (#677, @jendrikseipp).
* added feature to auto-indent text in editor (#561, Allen Benter)
* Code review changes for adding auto-indent feature (#561, #562, Varunjay Varma)

# 2.33 (2024-05-05)
* Ignore image filenames and web links in word clouds (#537, #696, @laraconda).
Expand Down
1 change: 1 addition & 0 deletions rednotebook/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Config(dict):
"leftDividerPosition": 260,
"rightDividerPosition": None,
"cloudMaxTags": 1000,
"autoIndent": 1,
}

obsolete_keys = {
Expand Down
6 changes: 6 additions & 0 deletions rednotebook/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,12 @@ def load_values_from_config(self):

self.set_font(config.read("mainFont", editor.DEFAULT_FONT))

self.set_auto_indent()

def set_auto_indent(self):
auto_indent = self.journal.config.read("autoIndent") == 1
self.day_text_field.day_text_view.set_auto_indent(auto_indent)

def set_font(self, font_name):
self.day_text_field.set_font(font_name)
self.html_editor.set_font_size(
Expand Down
3 changes: 3 additions & 0 deletions rednotebook/gui/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ def on_options_dialog(self):

self.options.append(TickOption(_("Search as you type"), "instantSearch"))

self.options.append(TickOption(_("Auto indent"), "autoIndent"))

def check_version_action(widget):
utils.check_new_version(
self.main_window.journal, info.version, startup=False
Expand Down Expand Up @@ -379,6 +381,7 @@ def check_version_action(widget):
# Apply some options
self.main_window.cloud.update_lists()
self.main_window.cloud.update(force_update=True)
self.main_window.set_auto_indent()

visible = self.config.read("closeToTray") == 1
self.main_window.tray_icon.set_visible(visible)
Expand Down
Loading