1. Shian Lee's Unicode/Utf8 editor, "edu.ex" Tricks and Tips

Version 2.0 of edu.ex for Euphoria 3.1.1 is available in Lee's lib2 library: Download: lib2

Very interesting Euphoria 3.1.1 library "upgrade" package with a nice installation program. Lee has added a number of neat enhancements to edu.ex check it out!

You probably would like to add the following code at the top of the edu.ex source code file just after the include statements:

edit 1/19/2018: platform used instead of ifdef which is not available in Euphoria 3.1.1

-- patch to fix Linux screen positioning 
-- from euphoria 4.x ed.ex, by John Brown, I think 
-- requires misc.e for platform() 
include misc.e 
procedure get_real_text_starting_position() 
    sequence sss = "" 
    integer ccc 
    puts(1, 27&"[6n") 
    while 1 do 
	ccc = get_key() 
	if ccc = 'R' then 
	    exit 
	end if 
	if ccc != -1 then 
	    sss &= ccc 
	end if 
    end while 
    sss = sss[3..$] 
    sequence aa, bb 
    aa = value(sss[1..find(';', sss)-1]) 
    bb = value(sss[find(';', sss)+1..$]) 
    position(aa[2], bb[2]) 
end procedure 
if platform = LINUX then 
    get_real_text_starting_position() 
end if 
new topic     » topic index » view message » categorize

2. Re: Shian Lee's Unicode/Utf8 editor, "edu.ex" Tricks and Tips

Shian Lee continues to improve "edu.ex". That line is beginning to be a mantra. Many thanks, Shian!

 
procedure new_file_from_list() 
-- comment out the last line if you do not want the file  
-- selector to revert back to the initial startup directory 
 
--  ok = chdir(save_dir) -- restore current directory 
end procedure 
 
 
-- the JAPI GUI works like a charm. This may be the best, 
-- perhaps the only cross platform GUI worth using.  I hope -- Shian, or someone will can issue a Euphoria 4.x version 
 
-- just for fun... if you JAPI working, you can use the JAPI -- GUI fileselector. I don't suppose there is any real  
-- reason to do this as Shian's new_file_from_list()  
-- routine is solid as the rock of Gibralter 
 
include japi.e 
-- edit the last few lines of the new file routine after the  
-- save_state() command: 
elsif command[1] = 'n' then  
~ 
~ 
 save_state()                                                                                                                              
  if j_start() then                                                                                                                         
    answer = j_fileselect(j_frame(""), "Select File","*.e*")                                                                             
    j_quit()                                                                                                                              
  else                                                                                                                                      
   set_top_line("new file name (Esc=List): ")                                                                                            
   answer = delete_trailing_white(key_gets("",file_history))                                                                            
  end if                                                                                                                                    
                                                                                                                                                  
  if length(answer) != 0 then                                                                                                               
     file_name = answer                                                                                                                    
     stop = TRUE                                                                                                                           
  else                                                                                                                                      
     new_file_from_list() -- (Shian)                                                                                                       
  end if                                     

Thanks again, Shian!
Ken Rhodes

new topic     » goto parent     » topic index » view message » categorize

3. Re: Shian Lee's Unicode/Utf8 editor, "edu.ex" Tricks and Tips

 
-- more JAPI GUI fun code for edu.ex 
 
-- the following code allows the user to open a new file or existing file 
-- in a new window by using the keystrokes ESC N 
-- or open an new or existing file in the current window using 
-- using keystrokes ESC n 
 
-- An existing file can be opened in a new window 
-- using the keystrokes ESC O 
-- or open and existing file in the current window 
-- using the keystrokes ESC o 
 
include japi.e 
procedure new_file(boolean NewFile) 
sequence answer 
  if modified and last_use() then 
    while TRUE do 
	set_top_line("") 
	putsu("save changes to " & file_name & '?') 
	answer = key_gets("yn", {}) 
	if find('y', answer) then 
	  save_file(file_name) 
          exit 
	elsif find('n', answer) then 
	  exit 
	end if 
    end while 
   end if 
   save_state() 
   if j_start() then 
    if NewFile then 
      -- open new file: new_file(TRUE) 
      -- j_fileselect allows user to type in a new file name 
      -- or select an existing file from an unsorted file 
      -- list 
      answer = j_fileselect(j_frame(""), "Select File", "*.e*") 
    else 
      -- open existing file: new_file(FALSE) 
      -- j_filedialog allow user to only open an existing file 
      --  from a sorted file list 
      answer = j_filedialog(j_frame(""),"Open File","*.e*")  
    end if 
    j_quit() 
   else 
     set_top_line("new file name (Esc=List): ") 
     answer = delete_trailing_white(key_gets("", file_history)) 
   end if 
   if length(answer) != 0 then 
     file_name = answer 
     stop = TRUE 
   else  
     new_file_from_list() -- (Shian) 
   end if 
end procedure 
 
procedure get_escape(boolean help) 
~ 
-- comment out the current command = key_gets~ line 
-- and add the following line: 
 
command = key_gets("hcqswnNoOedfrlmvj", {}) & '' 
~ 
-- comment out the current elsif command[1] = 'n' line 
-- and add the following lines: 
 
    elsif command[1] = 'n' or command[1] = 'N' then 
	-- new file in new or current window 
      if command[1] = 'N' then 
	    -- new file in new window 
	  clone_window() 
       end if 
       -- open a new file in current window 
       new_file(TRUE) 
 
    elsif command[1] = 'o' or command[1] = 'O' then 
	  -- open and existing file in new or current window 
	if command[1] = 'O' then 
		-- open an existing file in new window 
	    clone_window() 
	end if 
		-- open an existing file in current window 
	new_file(FALSE) 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu