Skip to content

feat: Replace floating window with horizontal split and preserve Japanese in filenames#20

Merged
Cassin01 merged 1 commit into
mainfrom
ttt
Jan 20, 2026
Merged

feat: Replace floating window with horizontal split and preserve Japanese in filenames#20
Cassin01 merged 1 commit into
mainfrom
ttt

Conversation

@Cassin01
Copy link
Copy Markdown
Owner

Summary

  • Fix sanitize_title to preserve Japanese characters in filenames
  • Replace floating window (open_in_window) with horizontal split (open_in_split)
  • Add goto_last_line to move cursor to last line after opening memo

Changes

1. Fix Japanese character handling in sanitize_title

  • Changed from whitelist pattern [^%w%-%_]+ (ASCII only) to blacklist pattern
  • Japanese characters are now preserved in memo filenames

2. Replace floating window with horizontal split

  • Added M.open_in_split function using botright split
  • Marked M.open_in_window as currently unused
  • Replaced all usages in M.create and M.open

3. Move cursor to last line

  • Added goto_last_line helper function
  • Called after opening memo for immediate content entry

Test plan

  • All existing tests pass
  • New Japanese character tests pass
  • Manual test: Create memo with Japanese title
  • Manual test: Verify memo opens in horizontal split at bottom
  • Manual test: Verify cursor is at last line

🤖 Generated with Claude Code

- Add open_in_split function for bottom horizontal split
- Add goto_last_line to move cursor after opening
- Mark open_in_window as currently unused
- Replace all open_in_window calls with open_in_split
Copilot AI review requested due to automatic review settings January 20, 2026 14:58
@Cassin01 Cassin01 merged commit f222659 into main Jan 20, 2026
5 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request replaces the floating window UI with a horizontal split layout and adds cursor positioning to the last line after opening memos.

Changes:

  • Added goto_last_line helper function to move cursor to the last line of the current buffer
  • Implemented open_in_split function to open memos in a bottom horizontal split instead of floating window
  • Replaced open_in_window calls with open_in_split in both M.create and M.open functions

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
fnl/sm/memo.fnl Added goto_last_line and open_in_split functions; replaced floating window calls with horizontal split; marked open_in_window as unused
lua/sm/memo.lua Generated Lua output from Fennel source (should not be manually edited per project guidelines)

Comment thread lua/sm/memo.lua
M.open = function(filepath)
local filename = vim.fn.fnamemodify(filepath, ":t")
M.open_in_window(filepath)
M.open_in_split(filepath)
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated Lua file should not be edited directly. According to the project's coding guidelines, only Fennel source files in fnl/**/*.fnl should be edited. The Lua files in lua/ are auto-generated by running 'make'. Please revert any direct changes to this file and ensure all edits are made to fnl/sm/memo.fnl instead, then regenerate the Lua file using 'make'.

Copilot generated this review using guidance from repository custom instructions.
Comment thread fnl/sm/memo.fnl
"Open specific memo"
(let [filename (vim.fn.fnamemodify filepath ":t")]
(M.open_in_window filepath)
(M.open_in_split filepath)
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cursor is moved to the last line when creating a new memo, but not when opening an existing memo. This creates inconsistent behavior. Consider also calling goto_last_line after M.open_in_split in the M.open function to ensure users can immediately start editing in both cases.

Suggested change
(M.open_in_split filepath)
(M.open_in_split filepath)
(goto_last_line)

Copilot uses AI. Check for mistakes.
Comment thread lua/sm/memo.lua
Comment on lines +120 to +133
local function goto_last_line()
local last_line = vim.api.nvim_buf_line_count(0)
return vim.api.nvim_win_set_cursor(0, {last_line, 0})
end
M.open_in_split = function(filepath)
local buf = vim.fn.bufadd(filepath)
vim.fn.bufload(buf)
vim.bo[buf]["filetype"] = "markdown"
vim.cmd("botright split")
vim.api.nvim_win_set_buf(0, buf)
vim.wo["wrap"] = true
try_attach_copilot(1)
return buf
end
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated Lua file should not be edited directly. According to the project's coding guidelines, only Fennel source files in fnl/**/*.fnl should be edited. The Lua files in lua/ are auto-generated by running 'make'. Please revert any direct changes to this file and ensure all edits are made to fnl/sm/memo.fnl instead, then regenerate the Lua file using 'make'.

Copilot generated this review using guidance from repository custom instructions.
Comment thread lua/sm/memo.lua
Comment on lines +163 to +164
M.open_in_split(filepath)
goto_last_line()
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated Lua file should not be edited directly. According to the project's coding guidelines, only Fennel source files in fnl/**/*.fnl should be edited. The Lua files in lua/ are auto-generated by running 'make'. Please revert any direct changes to this file and ensure all edits are made to fnl/sm/memo.fnl instead, then regenerate the Lua file using 'make'.

Copilot generated this review using guidance from repository custom instructions.
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