Skip to content
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
27 changes: 22 additions & 5 deletions .github/workflows/build-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ jobs:
# macOS needs nothing extra: Cocoa/Metal ship with the OS, and the
# runners already have the Xcode command-line tools installed.

- name: Embed Windows icon resource
if: matrix.goos == 'windows'
shell: bash
run: |
set -euo pipefail
pip install Pillow --quiet
python3 -c "
from PIL import Image
img = Image.open('src/internal/app/icon.png')
img.save('src/cmd/simplenvim/icon.ico', format='ICO',
sizes=[(16,16),(32,32),(48,48),(64,64),(128,128),(256,256)])
"
cd src/cmd/simplenvim
windres -o app_windows.syso app.rc

- name: Build
working-directory: src
shell: bash
Expand All @@ -76,15 +91,17 @@ jobs:
shell: bash
run: |
set -euo pipefail
name="simplenvim_${{ inputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}"
archive="simplenvim_${{ inputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}"
dir="simplenvim_${{ matrix.goos }}_${{ matrix.goarch }}"
mkdir -p "dist/${dir}"
cp dist/simplenvim$([ "${{ matrix.goos }}" = "windows" ] && echo .exe) LICENSE README.md "dist/${dir}/"
cd dist
cp ../LICENSE ../README.md .
if [ "${{ matrix.goos }}" = "windows" ]; then
7z a "${name}.zip" simplenvim.exe LICENSE README.md
7z a "${archive}.zip" "${dir}/"
else
tar czf "${name}.tar.gz" simplenvim LICENSE README.md
tar czf "${archive}.tar.gz" "${dir}/"
fi
rm -f simplenvim simplenvim.exe LICENSE README.md
rm -rf "${dir}" simplenvim simplenvim.exe LICENSE README.md 2>/dev/null || true
ls -l

- name: Upload artifact
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,23 @@ jobs:

- uses: actions/download-artifact@v4
with:
path: dist
path: staging
merge-multiple: true

- name: Collect release assets
run: |
set -euo pipefail
mkdir -p dist
find staging -type f \( -name '*.tar.gz' -o -name '*.zip' -o -name '*.deb' \
-o -name '*.rpm' -o -name '*.exe' -o -name '*.dmg' -o -name '*.msi' \
-o -name '*.pkg.tar.zst' \) -exec mv -t dist/ {} +
ls -l dist

- name: Generate checksums
working-directory: dist
run: |
set -euo pipefail
find . -maxdepth 1 -type f ! -name SHA256SUMS.txt -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS.txt
sha256sum * > SHA256SUMS.txt
cat SHA256SUMS.txt

- name: Publish dated pre-release
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: |
set -euo pipefail
mkdir -p stage
tar xzf incoming/*.tar.gz -C stage
tar xzf incoming/*.tar.gz --strip-components=1 -C stage
chmod +x stage/simplenvim
ls -l stage

Expand All @@ -59,7 +59,12 @@ jobs:
mkdir -p dist
nfpm package -f packaging/nfpm.yaml -p deb -t dist/
nfpm package -f packaging/nfpm.yaml -p rpm -t dist/
ls -l dist
# Rename to include "linux" in filenames for clarity.
cd dist
for f in *.deb *.rpm; do
mv "$f" "$(echo "$f" | sed 's/^simplenvim_/simplenvim_linux_/' | sed 's/^simplenvim-/simplenvim-linux-/')"
done
ls -l

- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -87,6 +92,8 @@ jobs:
set -euo pipefail
mkdir -p stage
unzip -o incoming/*.zip -d stage
# Flatten the subdirectory created by the archive step.
mv stage/simplenvim_*/* stage/ 2>/dev/null || true
ls -l stage

- name: Compile installer
Expand Down Expand Up @@ -170,7 +177,7 @@ jobs:
set -euo pipefail
mkdir -p stage dist

tar xzf incoming/*.tar.gz -C stage
tar xzf incoming/*.tar.gz --strip-components=1 -C stage
chmod +x stage/simplenvim

if [ "$ARCH" = "amd64" ]; then pkgarch="x86_64"; else pkgarch="aarch64"; fi
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ binary.
Nvim's own input protocol.
- Live window resizing.
- A small, plain `config.toml` for font and Nvim-launch settings.
- Nerd font support.

Simple and pure — no bloat, no bundled plugin marketplace, no telemetry.

## Installing

**Note: all installation packages are exclusively generated by github free CD pipeline. No 3rd party is involved, during the package creation.**
**(All installation packages are exclusively generated by github CI-CD pipeline, where all github security check is on. No 3rd party is involved, during the package creation.)**

Grab a build for your platform from the
[Releases page](https://github.com/kgfly/SimpleNvimEditor/releases).
Expand Down
14 changes: 13 additions & 1 deletion packaging/macos/make-dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@ rm -rf build dist
mkdir -p build dist

echo "==> Extracting binary"
tar xzf incoming/*.tar.gz -C build
tar xzf incoming/*.tar.gz --strip-components=1 -C build
chmod +x build/simplenvim

echo "==> Assembling ${BUNDLE}"
mkdir -p "build/${BUNDLE}/Contents/MacOS"
mkdir -p "build/${BUNDLE}/Contents/Resources"
mv build/simplenvim "build/${BUNDLE}/Contents/MacOS/simplenvim"

# Build an .icns icon set from the embedded icon.png.
ICONSET="build/AppIcon.iconset"
mkdir -p "${ICONSET}"
ICON_SRC="src/internal/app/icon.png"
for sz in 16 32 64 128 256 512; do
sips -z ${sz} ${sz} "${ICON_SRC}" --out "${ICONSET}/icon_${sz}x${sz}.png" >/dev/null
dbl=$((sz * 2))
sips -z ${dbl} ${dbl} "${ICON_SRC}" --out "${ICONSET}/icon_${sz}x${sz}@2x.png" >/dev/null
done
iconutil -c icns "${ICONSET}" -o "build/${BUNDLE}/Contents/Resources/AppIcon.icns"

cat > "build/${BUNDLE}/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Expand All @@ -42,6 +53,7 @@ cat > "build/${BUNDLE}/Contents/Info.plist" <<PLIST
<key>CFBundleExecutable</key> <string>simplenvim</string>
<key>CFBundlePackageType</key> <string>APPL</string>
<key>CFBundleSignature</key> <string>????</string>
<key>CFBundleIconFile</key> <string>AppIcon</string>
<key>LSMinimumSystemVersion</key> <string>11.0</string>
<key>NSHighResolutionCapable</key> <true/>
<key>NSSupportsAutomaticGraphicsSwitching</key><true/>
Expand Down
4 changes: 2 additions & 2 deletions packaging/windows/simplenvim.iss
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Source: "..\..\LICENSE"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\README.md"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Registry]
Root: HKA; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; \
Expand Down
1 change: 1 addition & 0 deletions src/cmd/simplenvim/app.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IDI_ICON1 ICON "icon.ico"
17 changes: 17 additions & 0 deletions src/internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func (a *App) handleInput(gtx layout.Context) {
event.Op(gtx.Ops, rootTag)
area.Pop()

// Tell Gio this tag is an active text-input client so the platform
// layer (NSTextInputClient on macOS) routes IME and voice dictation
// through EditEvent instead of swallowing it.
key.InputHintOp{Tag: rootTag, Hint: key.HintAny}.Add(gtx.Ops)

if !a.focused {
gtx.Execute(key.FocusCmd{Tag: rootTag})
}
Expand All @@ -164,6 +169,8 @@ func (a *App) handleInput(gtx layout.Context) {
a.focused = ev.Focus
case key.Event:
a.onKey(ev)
case key.EditEvent:
a.onEdit(ev)
case pointer.Event:
a.onPointer(ev)
}
Expand All @@ -179,6 +186,16 @@ func (a *App) onKey(e key.Event) {
}
}

// onEdit forwards text produced by an input method (macOS Dictation, CJK
// IME, Emoji picker, etc.) to Nvim. EditEvent.Text may contain multiple
// characters; Nvim's nvim_input accepts them as a UTF-8 byte string.
func (a *App) onEdit(e key.EditEvent) {
if a.proc == nil || e.Text == "" {
return
}
a.proc.Input(e.Text)
}

func (a *App) onPointer(e pointer.Event) {
if a.proc == nil || a.fonts.Metrics.CellWidth == 0 {
return
Expand Down
6 changes: 4 additions & 2 deletions src/internal/render/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ type Fonts struct {
// NewShaper builds a text shaper according to the configuration: either the
// bundled, fully self-contained Go Mono typeface (the default, chosen so
// the app renders identically regardless of what's installed on the host),
// or the system font matcher when the user opts in.
// or the system font matcher when the user opts in. System-font mode still
// includes the bundled Go Mono as a fallback so text never disappears if a
// configured family can't be found.
func NewShaper(cfg config.EditorConfig) *text.Shaper {
if cfg.UseSystemFonts {
return text.NewShaper()
return text.NewShaper(text.WithCollection(gofont.Collection()))
}
return text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
}
Expand Down
25 changes: 25 additions & 0 deletions src/test/unit/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,28 @@ func TestFrameWithEmptyTextCells(t *testing.T) {
})
runFrame(t, s.Snapshot())
}

func TestFrameCursorZeroPercentage(t *testing.T) {
s := uistate.New()
s.Apply([][]interface{}{
{"grid_resize", []interface{}{1, 10, 5}},
{"grid_cursor_goto", []interface{}{1, 0, 0}},
{"mode_info_set", []interface{}{true, []interface{}{
map[string]interface{}{"cursor_shape": "vertical", "cell_percentage": 0},
}}},
{"mode_change", []interface{}{"normal", 0}},
})
runFrame(t, s.Snapshot())
}

func TestFrameWithPlacedSplitWindow(t *testing.T) {
s := uistate.New()
s.Apply([][]interface{}{
{"grid_resize", []interface{}{1, 40, 20}},
{"grid_resize", []interface{}{2, 20, 10}},
{"win_pos", []interface{}{2, 0, 0, 0, 20, 10}},
{"grid_line", []interface{}{2, 0, 0, []interface{}{[]interface{}{"hello split"}}}},
{"grid_cursor_goto", []interface{}{2, 0, 5}},
})
runFrame(t, s.Snapshot())
}
Loading