Skip to content

Fix(tui): a new note opens in the editor always, despite the set default mode - #26

Merged
adibhanna merged 1 commit into
ZenNotes:zn-0.14.0from
spirit-of-light:fix-new-note-edit-view
Nov 1, 2026
Merged

adibhanna merged 1 commit into
ZenNotes:zn-0.14.0from
spirit-of-light:fix-new-note-edit-view

Conversation

@spirit-of-light

Copy link
Copy Markdown
Contributor

Creating a note puts you in insert mode, but with the default pane mode set to preview or split, the new tab showed the preview. You were typing into a buffer you couldn't see.

createNote opened the note through openNote, which picks the tab's mode from DefaultPaneMode (or the mode remembered for that path), and then sent Vim A. It now sets the new note's tab to edit mode directly. It doesn't go through setPaneMode, so with "retain view mode" on, the default pane mode and the remembered per-note modes are left as they were.

Tests: new TestCreateNoteOpensInEditMode sets the default to preview, creates a note and expects edit mode. It fails on main ("new note opened in mode preview, want edit") and passes here. go test -race ./..., go vet ./..., go build ./cmd/zn, git diff --check and bash scripts/sandbox.sh --smoke pass. Checked by hand in the TUI: a new note shows the editor straight away.

🤖 Generated with Claude Code

createNote opened the note with the default pane mode (or the mode
remembered for that path) and then entered insert mode. With a preview or
split default, you were typing into a buffer the screen didn't show.
The new note's tab is now set to edit mode directly, which leaves the
default pane mode and the remembered per-note modes unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spirit-of-light spirit-of-light changed the title Fix(tui): a new note opens in the editor whatever the default pane mode Fix(tui): a new note opens in the editor always, despite the set default mode Oct 31, 2026
@adibhanna
adibhanna changed the base branch from main to zn-0.14.0 November 1, 2026 20:03
adibhanna added a commit that referenced this pull request Nov 1, 2026
#26 shows the editor for a note made through createNote (`:new`, the
new-note prompt, a quick note, Enter on no match in Search notes, the
sidebar's new note, following a link to a missing note) when the default
view mode is preview or split. A daily, weekly or monthly note created on
first open, a note from a template, a `:taskfile` task and the daily note
`:rollover` creates make their note without createNote, so they still
opened in preview, with the template's cursor placed in a buffer nobody
could see.

They now call the same showNewNoteInEditor right after opening the note,
as the desktop's rememberEditModeForCreatedNote covers its new, daily,
template and task notes (ZenNotes/zennotes da328744). Only the new note's
tab changes: the default view mode and the remembered per-note modes stay
as they were, and a note that is already there, rollover into an existing
daily note included, still opens in the default. A database record page
keeps the default too, as on the desktop.

Tests: every creation path under a preview and a split default, with
keep_view_mode_across_notes on, opens in edit and leaves the default and
the remembered modes alone; the new periodic, template, task-file and
rollover cases fail without this change. An existing daily note, rollover
into it and an existing note open in preview. Checked by hand in zn tui
with default_view_mode = "preview": a new daily note and a note from the
Meeting Notes template open in the editor, Welcome opens in preview.
@adibhanna
adibhanna merged commit 0381c69 into ZenNotes:zn-0.14.0 Nov 1, 2026
5 checks passed
adibhanna added a commit that referenced this pull request Nov 1, 2026
…ault mode (by @spirit-of-light)

With the review follow-ups on top of the contributor's commits.
adibhanna added a commit that referenced this pull request Nov 1, 2026
#26 and #28 fixed the same thing from two sides. #26's showNewNoteInEditor
set a new note's tab to edit right after it opened, and its follow-up called
it from every creation path. #28 marks a note as new before the open
(markNewNote), and since its follow-up a marked note always opens in the
editor. Merged together, every creation path called both, one after the
other, to the same end.

The mark stays, since it acts inside the open itself, before a default,
remembered or frontmatter mode is applied, and showNewNoteInEditor goes.
Every creation path #26's follow-up covers already marks its note, and its
tests (a new periodic, template, task-file and rollover note under a
preview and a split default) pass on the mark alone, as do #28's.
@adibhanna

Copy link
Copy Markdown
Contributor

Thanks! This is merged into zn-0.14.0 and ships in zn 0.14.0.

One follow-up, d3401ca: a daily, weekly or monthly note made on first open, a note from a template, :taskfile and :rollover make their note outside createNote, so they still opened in preview. They now open in the editor too, as on the desktop.

Since #28 fixed the same thing from the other side (a new-note mark applied during the open), 020afdc keeps that one mechanism and drops showNewNoteInEditor. Your test and the follow-up's tests pass on the mark alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants