summaryrefslogtreecommitdiffstats
path: root/debian/patches/upstream/cfdisk-fix-menu-behavior-after-writing-changes.patch
blob: 71d466c9239e69db171fe997e90cd244d6d1e763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From: Karel Zak <kzak@redhat.com>
Date: Mon, 26 Jun 2023 13:25:11 +0200
Subject: cfdisk: fix menu behavior after writing changes

Florian wrote:
  after a successful write, cfdisk remains on the "Write" cursor and
  furthermore when navigating to "Quit" will continue to  show
  "...without writing changes", despite there were writes. This patch
  addresses that.

Based on patch from Florian Zimmermann <florian.zimmermann@gmail.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
Closes: #927041
---
 disk-utils/cfdisk.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
index fde2029..3fe852a 100644
--- a/disk-utils/cfdisk.c
+++ b/disk-utils/cfdisk.c
@@ -2525,11 +2525,15 @@ static int main_menu_action(struct cfdisk *cf, int key)
 		if (rc)
 			warn = _("Failed to write disklabel.");
 		else {
+			size_t q_idx = 0;
+
 			if (cf->device_is_used)
 				fdisk_reread_changes(cf->cxt, cf->original_layout);
 			else
 				fdisk_reread_partition_table(cf->cxt);
 			info = _("The partition table has been altered.");
+			if (menu_get_menuitem_by_key(cf, 'q', &q_idx))
+				ui_menu_goto(cf, q_idx);
 		}
 		cf->nwrites++;
 		break;