aboutsummaryrefslogtreecommitdiff
path: root/main.F90
diff options
context:
space:
mode:
Diffstat (limited to 'main.F90')
-rw-r--r--main.F9029
1 files changed, 22 insertions, 7 deletions
diff --git a/main.F90 b/main.F90
index 24cecfc..9055664 100644
--- a/main.F90
+++ b/main.F90
@@ -59,6 +59,7 @@ implicit none
logical::running
logical::loaded
logical::populated
+ logical::redo_layout
integer::return_code
character(256)::return_type
@@ -101,13 +102,14 @@ implicit none
locations_visited => null()
current_url = initial_site
+ first_line => null()
open(unit=io, form="formatted", status="scratch", access='stream')
do while(running)
if(index(current_url, "gemini://") /= 1) then
- call r%report_unsupported_protocol(trim(current_url))
+ redo_layout = r%report_unsupported_protocol(trim(current_url))
populated = .false.
loaded = .true.
return_code = STATUS_LOCALFAIL
@@ -145,12 +147,18 @@ implicit none
if(r%type_supported(return_type)) then
+ ! Only erase if we're loading new lines!
+ if(associated(first_line)) then
+ call free_lines(first_line)
+ end if
+
first_line => load_unit(io, file_type_gemini)
loaded = .true.
call r%new_page()
call r%report_status("Performing Layout")
call layout_lines(first_line, r)
call r%status_ready()
+
else
call r%draw_error("Cannot display file of type "//return_type)
@@ -158,6 +166,16 @@ implicit none
end if
+ else if(redo_layout) then
+
+ if(associated(first_line)) then
+ call r%report_status("Performing Layout")
+ call layout_lines(first_line, r)
+ call r%status_ready()
+ end if
+
+ redo_layout = .false.
+
end if
do while(loaded .and. running)
@@ -168,9 +186,6 @@ implicit none
case (render_action_back)
call back_location(locations_visited, current_url)
- if(associated(first_line)) then
- call free_lines(first_line)
- end if
loaded = .false.
case (render_action_layout)
@@ -188,9 +203,9 @@ implicit none
call handle_relative_url(current_url, input)
end if
- if(associated(first_line)) then
- call free_lines(first_line)
- end if
+ !if(associated(first_line)) then
+ ! call free_lines(first_line)
+ !end if
loaded = .false.
end select