Skip to content

[desktop] Fix inline markdown input rules triggering mid-paragraph#21

Merged
usamaasfar merged 2 commits intoeditor-improvementsfrom
codex/sub-pr-18
Feb 21, 2026
Merged

[desktop] Fix inline markdown input rules triggering mid-paragraph#21
usamaasfar merged 2 commits intoeditor-improvementsfrom
codex/sub-pr-18

Conversation

@Codex
Copy link
Contributor

@Codex Codex AI commented Feb 21, 2026

Inline markdown shortcuts (*bold*, _italic_, etc.) only fired at line ends due to end-of-string regex anchors, breaking normal mid-paragraph typing.

  • Input rules: Replaced $ end anchors with whitespace/end lookaheads so marks apply anywhere in a line while still requiring a boundary.
  • Marks covered: Italic, bold, strikethrough (single/double tilde), and inline code now trigger after a space or line end.

Example:

// before: only matched at EOL
markRule(/\*([^*]+)\*$/, strong);

// after: matches before space or EOL
markRule(/\*([^*]+)\*(?=\s|$)/, strong);

Greptile Summary

Fixed inline markdown shortcuts to trigger mid-paragraph instead of only at line ends by replacing $ end-of-string regex anchors with (?=\s|$) lookaheads.

  • All five inline mark rules (italic, bold, strikethrough variants, inline code) now trigger after typing a space or at line end
  • Lookahead implementation correctly preserves whitespace while removing only the delimiter characters
  • Improves natural typing flow - users can now format text mid-paragraph without workarounds

Confidence Score: 5/5

  • This PR is safe to merge with no concerns
  • The change is a well-isolated regex pattern fix that correctly uses positive lookaheads to preserve whitespace while triggering input rules mid-paragraph. The implementation properly handles the match boundaries and deletion logic.
  • No files require special attention

Important Files Changed

Filename Overview
apps/desktop/src/editor/Editor.tsx Fixed inline markdown input rules to trigger mid-paragraph by replacing end-of-string anchors with lookaheads - implementation is correct and improves UX

Last reviewed commit: ac678f7

@Codex Codex AI changed the title [WIP] Fix critical bug in inline markdown input rules [desktop] Fix inline markdown input rules triggering mid-paragraph Feb 21, 2026
@Codex Codex AI requested a review from usamaasfar February 21, 2026 19:47
@usamaasfar usamaasfar marked this pull request as ready for review February 21, 2026 19:48
@usamaasfar usamaasfar merged commit d8d2d07 into editor-improvements Feb 21, 2026
1 check passed
@usamaasfar usamaasfar deleted the codex/sub-pr-18 branch February 21, 2026 19:52
usamaasfar added a commit that referenced this pull request Feb 21, 2026
* Improve editor writing experience

- Add inline mark input rules: _italic_, *bold*, ~strikethrough~, `code`
- Add Cmd+Enter as hard break (alongside Shift+Enter)
- Add underline mark with Cmd+U shortcut
- Add --- input rule to insert horizontal rule
- Restore caretPlugin (pulled from main)
- Fade-in animation on editor mount
- Remove first-heading top margin
- Tighten typography: line-height 1.75, paragraph spacing 0.5em

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Disable autocomplete and spellcheck on rename input

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Hide title by default, reveal on hover and file switch

Title is hidden by default and fades in (400ms) on topbar hover.
Untitled stays always visible as a nudge to rename.
Flashes visible for 1.2s on file switch via useTitleVisibility hook.
Stays visible while renaming.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Delete .npmrc

* [desktop] Fix inline markdown input rules triggering mid-paragraph (#21)

* Initial plan

* Fix inline markdown input rule anchors

---------

Co-authored-by: openai-code-agent[bot] <242516109+Codex@users.noreply.github.com>

* Refine command palette styling for a more minimal look

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Codex <242516109+Codex@users.noreply.github.com>
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