Chapter 4 — Editing Files

wxeditor Last Updated: 2026-10-22 10:57 Views: 38

Chapter 4 — Editing Files

4.1 Opening & Saving

Double-click a file in the tree to open it (see Chapter 3). Save actions live in the “File (F)” menu and the toolbar:

  • Save Ctrl+S: writes back to the original location; remote files upload over SFTP.
  • Save As Ctrl+Shift+S: pick a new name/location.
  • Save All Ctrl+Alt+S: save every modified tab at once.

When saving a remote file fails due to permissions, a dialog asks for a sudo-capable username/password to save with elevated rights.

4.2 Syntax Highlighting & Folding

The editor loads the Lua highlighter script matching the file extension from the code/ directory — 50+ languages are covered (Rust, Python, JavaScript/TypeScript, Go, Java, C/C++/C#, Ruby, PHP, Swift, Kotlin, Lua, Shell, SQL, HTML/CSS/XML, JSON/YAML/TOML, Markdown, Dockerfile, Verilog, Solidity, …). Scripts are user-replaceable.

Code folding is language-aware (braces inside comments/strings are ignored):

  • Click the gutter margin left of the line numbers to fold/unfold a region.
  • “View (V) → Fold All / Unfold All” (Ctrl+K Ctrl+0 / Ctrl+K Ctrl+J).

4.3 Editing Actions

The “Edit (E)” and “Selection (S)” menus cover the full text toolkit (menu screenshots are in Chapter 2):

Action Shortcut
Undo / Redo Ctrl+Z / Ctrl+Y
Cut / Copy / Paste Ctrl+X / Ctrl+C / Ctrl+V
Select All Ctrl+A
Move line up/down Alt+↑ / Alt+↓
Copy line up/down Shift+Alt+↑ / Shift+Alt+↓
Indent / Outdent Tab / Shift+Tab
To uppercase / lowercase Ctrl+U / Ctrl+L
Toggle comment Ctrl+/
Delete line Ctrl+Shift+K
Sort lines ascending/descending Selection menu
Trim trailing whitespace Edit menu
Format Ctrl+Shift+F (per-language Lua formatter)

4.4 Find & Replace

Ctrl+F opens the find bar at the bottom of the editor area:

Find bar

The bar provides: the search field, case-sensitive (Aa), Unicode, and regex (.*) toggles, previous/next match navigation, and a match counter.

Ctrl+H switches to replace mode, adding the replacement field and Replace / Replace All buttons:

Find & replace

Press Esc to close the bar.

4.5 Go to Line

The “Go (G)” menu has a single item:

Go menu

“Go (G) → Go To Line…” (Ctrl+G) opens a dialog; enter a line number to jump:

Go to line

4.6 HEX Mode

“View (V) → HEX Mode” switches the current file to a hexadecimal view — handy for binary files. Text-only actions are dimmed in HEX mode; click the menu item again to leave.

4.7 Font Zoom

  • Zoom in: Ctrl+= or “View (V) → Zoom In”
  • Zoom out: Ctrl+-
  • Reset: Ctrl+0

Zoom affects the editor font only and is persisted (see Chapter 7).

4.8 Encoding & Line Endings

The status bar shows the file’s encoding (e.g. UTF-8, GBK) and line ending (LF/CRLF). Click the encoding to open the list; switching re-decodes the file, and saving writes back in the current encoding. This is especially useful for editing remote files on legacy (GBK) systems.

← Previous Article Chapter 5 — Viewing & Readers Next Article → Chapter 3 — Projects

Comments

No comments yet