chore: revert navigation logic 60e5bb10
Steve · 2025-12-24 16:12 1 file(s) · +8 −10
Titan/Views/ContentView.swift +8 −10
170 170
            }
171 171
        }
172 172
173 +
        if historyIndex < history.count - 1 {
174 +
            history = Array(history.prefix(historyIndex + 1))
175 +
        }
176 +
173 177
        urlText = url
174 178
        fetchContent(addToHistory: true)
175 179
    }
208 212
                case .success:
209 213
                    let mimeType = response.meta
210 214
211 -
                    // Add to history on successful navigation (before showing content)
212 -
                    if addToHistory {
213 -
                        // Truncate forward history when navigating to a new page
214 -
                        if historyIndex < history.count - 1 {
215 -
                            history = Array(history.prefix(historyIndex + 1))
216 -
                        }
217 -
                        history.append(finalURL)
218 -
                        historyIndex = history.count - 1
219 -
                    }
220 -
221 215
                    if MediaType.isMediaContent(mimeType) {
222 216
                        // Handle media content (images, audio)
223 217
                        if let body = response.body {
233 227
                    } else {
234 228
                        // Handle text content (text/gemini, text/plain, etc.)
235 229
                        responseText = response.bodyText ?? "(empty response)"
230 +
                        if addToHistory {
231 +
                            history.append(finalURL)
232 +
                            historyIndex = history.count - 1
233 +
                        }
236 234
                    }
237 235
                case .input:
238 236
                    pendingInputURL = finalURL