mirror of
https://github.com/yann64/haikuports.git
synced 2026-03-19 01:46:00 +01:00
vim, bump version + add fullscreen patch (#12726)
Ideally the patch ought to be upstreamed, but it probably make sense to keep it in haikuports for a while first. Co-authored-by: cos <cos>
This commit is contained in:
135
app-editors/vim/patches/vim-9.1.1618.patchset
Normal file
135
app-editors/vim/patches/vim-9.1.1618.patchset
Normal file
@@ -0,0 +1,135 @@
|
||||
From ecb0869f8f3831359278a1cc5eb2ccfec2387b54 Mon Sep 17 00:00:00 2001
|
||||
From: cos <cos>
|
||||
Date: Sun, 20 Jul 2025 16:16:00 +0200
|
||||
Subject: [PATCH 1/2] Haiku: Add fullscreen mode
|
||||
|
||||
Makes toggling using keyboard possible. This change does not add any
|
||||
`:fullscreen` command (Which currently only macVim has).
|
||||
|
||||
See https://www.haiku-os.org/docs/userguide/en/keyboard-shortcuts.html
|
||||
for motivation on key combination used, as well as terminology choice.
|
||||
With vim being inconsistent (`:help intro` suggests <A> and <M>, while
|
||||
<Alt> is used at a dozen other places) following Haiku nomenclature
|
||||
seems most appropriate.
|
||||
---
|
||||
runtime/doc/os_haiku.txt | 3 +++
|
||||
src/gui_haiku.cc | 47 +++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 49 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/runtime/doc/os_haiku.txt b/runtime/doc/os_haiku.txt
|
||||
index 8fe8c9f56..ee8e6d48a 100644
|
||||
--- a/runtime/doc/os_haiku.txt
|
||||
+++ b/runtime/doc/os_haiku.txt
|
||||
@@ -76,6 +76,9 @@ version with GUI tries to determine if it was started from the Tracker instead
|
||||
of the Terminal, and if so, uses the GUI anyway. However, the current detection
|
||||
scheme is fooled if you use the command "vim - </dev/null".
|
||||
|
||||
+Toggling between normal managed window and fullscreen mode can be done by
|
||||
+pressing <Alt-Enter>.
|
||||
+
|
||||
Stuff that does not work yet:
|
||||
|
||||
- Mouse up events are not generated when outside the window. You can notice
|
||||
diff --git a/src/gui_haiku.cc b/src/gui_haiku.cc
|
||||
index 3865a4f4d..5d32607aa 100644
|
||||
--- a/src/gui_haiku.cc
|
||||
+++ b/src/gui_haiku.cc
|
||||
@@ -175,7 +175,7 @@ class VimWindow: public BWindow
|
||||
VimWindow();
|
||||
~VimWindow();
|
||||
|
||||
- // virtual void DispatchMessage(BMessage *m, BHandler *h);
|
||||
+ virtual void DispatchMessage(BMessage *m, BHandler *h);
|
||||
virtual void WindowActivated(bool active);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
@@ -184,6 +184,9 @@ class VimWindow: public BWindow
|
||||
private:
|
||||
void init();
|
||||
|
||||
+ bool is_fullscreen = false;
|
||||
+ BRect saved_frame;
|
||||
+ window_look saved_look;
|
||||
};
|
||||
|
||||
class VimFormView: public BView
|
||||
@@ -971,6 +974,48 @@ VimWindow::QuitRequested()
|
||||
write_port(gui.vdcmp, VimMsg::Key, &km, sizeof(km));
|
||||
return false;
|
||||
}
|
||||
+ void
|
||||
+VimWindow::DispatchMessage(BMessage *m, BHandler *h)
|
||||
+{
|
||||
+ bool should_propagate = true;
|
||||
+
|
||||
+ switch (m->what)
|
||||
+ {
|
||||
+ case B_KEY_DOWN:
|
||||
+ {
|
||||
+ int32 scancode = 0;
|
||||
+ int32 beModifiers = 0;
|
||||
+ m->FindInt32("raw_char", &scancode);
|
||||
+ m->FindInt32("modifiers", &beModifiers);
|
||||
+
|
||||
+ if (scancode == B_ENTER && (beModifiers & B_LEFT_COMMAND_KEY))
|
||||
+ {
|
||||
+ should_propagate = false;
|
||||
+ if (this->is_fullscreen)
|
||||
+ {
|
||||
+ this->is_fullscreen = false;
|
||||
+ ResizeTo(this->saved_frame.Width(), this->saved_frame.Height());
|
||||
+ MoveTo(this->saved_frame.left, this->saved_frame.top);
|
||||
+ SetLook(this->saved_look);
|
||||
+ SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
|
||||
+ } else {
|
||||
+ this->saved_frame = Frame();
|
||||
+ this->saved_look = Look();
|
||||
+ this->is_fullscreen = true;
|
||||
+ BScreen s(this);
|
||||
+ SetLook(B_NO_BORDER_WINDOW_LOOK);
|
||||
+ ResizeTo(s.Frame().Width() + 1, s.Frame().Height() + 1);
|
||||
+ MoveTo(s.Frame().left, s.Frame().top);
|
||||
+ SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_MOVABLE));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (should_propagate)
|
||||
+ Inherited::DispatchMessage(m, h);
|
||||
+}
|
||||
+
|
||||
|
||||
// ---------------- VimFormView ----------------
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
|
||||
From f8c865ad626d92d9bcf7f075b4d1667caa09c4bc Mon Sep 17 00:00:00 2001
|
||||
From: cos <cos>
|
||||
Date: Sun, 10 Aug 2025 08:30:21 +0200
|
||||
Subject: [PATCH 2/2] Haiku: Document missing Twitcher support
|
||||
|
||||
---
|
||||
runtime/doc/os_haiku.txt | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/runtime/doc/os_haiku.txt b/runtime/doc/os_haiku.txt
|
||||
index ee8e6d48a..37f07df3f 100644
|
||||
--- a/runtime/doc/os_haiku.txt
|
||||
+++ b/runtime/doc/os_haiku.txt
|
||||
@@ -89,7 +89,9 @@ Stuff that does not work yet:
|
||||
in when the window is activated or deactivated (so it works best with focus-
|
||||
follows-mouse turned on).
|
||||
- The cursor does not flash.
|
||||
-
|
||||
+- Switching windows using <C-Tab-Up> and <C-Tab-Down> in Twitcher does not
|
||||
+ work. This is due to each gvim window being managed by a separate instance
|
||||
+ completely unaware of other vim processes.
|
||||
|
||||
4. The $VIM directory *haiku-vimdir*
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -14,8 +14,9 @@ COPYRIGHT="1991-2025 Bram Moleenar et al."
|
||||
LICENSE="Vim"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/vim/vim/archive/v$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="703406505a2e4df02664ef92c6857b2e1220ffa0a6355e587d57a9e2b9f9615f"
|
||||
CHECKSUM_SHA256="3078aaa7e72054ae025eebb81f40aad567054dcea3ff68f5ebecd94874568cf8"
|
||||
SOURCE_FILENAME="vim-$portVersion.tar.gz"
|
||||
PATCHES="vim-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
Reference in New Issue
Block a user