Honor forced history
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
22ababad36dd766ef3d58661066a7765ebdb6bf3- Parents
-
4593e16 - Tree
c11bb1e
22ababa
22ababad36dd766ef3d58661066a7765ebdb6bf34593e16
c11bb1e| Status | File | + | - |
|---|---|---|---|
| M |
src/fgof_lineedit.f90
|
12 | 1 |
src/fgof_lineedit.f90modified@@ -105,6 +105,9 @@ contains | ||
| 105 | 105 | character(len=:), allocatable, intent(out) :: line |
| 106 | 106 | logical, intent(in), optional :: store_history |
| 107 | 107 | logical :: should_store |
| 108 | + type(history_entry), allocatable :: new_history(:) | |
| 109 | + integer :: count | |
| 110 | + integer :: i | |
| 108 | 111 | |
| 109 | 112 | call normalize_lineedit(editor) |
| 110 | 113 | line = editor%buffer |
@@ -115,7 +118,15 @@ contains | ||
| 115 | 118 | should_store = len_trim(line) > 0 |
| 116 | 119 | end if |
| 117 | 120 | |
| 118 | - if (should_store) call add_history_entry(editor, line) | |
| 121 | + if (should_store) then | |
| 122 | + count = history_count(editor) | |
| 123 | + allocate(new_history(count + 1)) | |
| 124 | + do i = 1, count | |
| 125 | + new_history(i)%text = editor%history(i)%text | |
| 126 | + end do | |
| 127 | + new_history(count + 1)%text = line | |
| 128 | + call move_alloc(new_history, editor%history) | |
| 129 | + end if | |
| 119 | 130 | |
| 120 | 131 | editor%buffer = "" |
| 121 | 132 | editor%cursor = 1 |