comparison src/name/blackcap/clipman/SearchDialog.kt @ 29:c4f53bc01732

Fix searching (and main display).
author David Barts <n5jrn@me.com>
date Wed, 29 Jan 2020 14:36:16 -0800
parents f1fcc1281dad
children 0c6c18a733b7
comparison
equal deleted inserted replaced
28:f1fcc1281dad 29:c4f53bc01732
161 if (result == null && origin != null && autoWrap) { 161 if (result == null && origin != null && autoWrap) {
162 result = doFind(null) 162 result = doFind(null)
163 } 163 }
164 if (result == null) { 164 if (result == null) {
165 Toolkit.getDefaultToolkit().beep() 165 Toolkit.getDefaultToolkit().beep()
166 origin = null
167 } else {
168 origin = when(direction) {
169 PasteboardQueue.Direction.FORWARDS ->
170 PasteboardQueue.Offset(result.inQueue, result.inItem + 1)
171 PasteboardQueue.Direction.BACKWARDS ->
172 if (result.inItem == 0) {
173 if (result.inQueue == 0) null else PasteboardQueue.Offset(result.inQueue - 1, -1)
174 } else {
175 PasteboardQueue.Offset(result.inQueue, result.inItem - 1)
176 }
177 }
166 } 178 }
167 origin = result
168 } 179 }
169 180
170 /* changing the search string resets the search origin */ 181 /* changing the search string resets the search origin */
171 override fun changedUpdate(e: DocumentEvent) { 182 override fun changedUpdate(e: DocumentEvent) {
172 if (e.document === _searchFor.document) { 183 if (e.document === _searchFor.document) {